Package com.eclipsesource.json

Examples of com.eclipsesource.json.JsonObject$Member


    assertEquals( "1.12", getPositionFromProblem( 0 ) );
  }

  @Test
  public void toleratesWindowsLineBreaks() {
    jsHint.configure( new JsonObject().add( "white", false ) );
    jsHint.check( "var x = 1;\r\nvar y = 2;\r\nvar z = 23 == null;", handler );

    assertEquals( "3.11", getPositionFromProblem( 0 ) );
  }
View Full Code Here


    assertTrue( JsonUtil.jsonEquals( "{\"a\":true}", "{\"a\":true}" ) );
  }

  @Test
  public void prettyPrint_emptyObject() {
    assertEquals( "{\n  \n}", JsonUtil.prettyPrint( new JsonObject() ) );
  }
View Full Code Here

    assertEquals( "{\n  \n}", JsonUtil.prettyPrint( new JsonObject() ) );
  }

  @Test
  public void prettyPrint_withNestedArray() {
    JsonObject object = new JsonObject()
      .add( "foo", true )
      .add( "bar", new JsonArray().add( 23 ).add( 42 ) );

    assertEquals( "{\n  \"foo\": true,\n  \"bar\": [23, 42]\n}", JsonUtil.prettyPrint( object ) );
  }
View Full Code Here

  }

  @Test
  public void usesWorkspaceOptionsByDefault() {
    workspacePrefs.getNode().put( "options", "a: 1, b: 1" );
    createProjectConfig( new JsonObject().add( "b", 2 ).add( "c", 2 ) );

    JsonObject configuration = new ConfigLoader( project ).getConfiguration();

    assertEquals( 1, configuration.get( "a" ).asInt() );
    assertEquals( 1, configuration.get( "b" ).asInt() );
    assertNull( configuration.get( "c" ) );
  }
View Full Code Here

  }

  @Test
  public void ignoresWorkspaceOptionsIfProjectSpecific() {
    workspacePrefs.getNode().put( "options", "a: 1, b: 1" );
    createProjectConfig( new JsonObject().add( "b", 2 ).add( "c", 2 ) );
    projectPrefs.setProjectSpecific( true );

    JsonObject configuration = new ConfigLoader( project ).getConfiguration();

    assertNull( configuration.get( "a" ) );
    assertEquals( 2, configuration.get( "b" ).asInt() );
    assertEquals( 2, configuration.get( "c" ).asInt() );
  }
View Full Code Here

  }

  @Test
  public void usesWorkspaceConfigIfNotProjectSpecific() {
    workspacePrefs.setConfig( "{\"a\": 1, \"b\": 1}" );
    createProjectConfig( new JsonObject().add( "b", 2 ).add( "c", 2 ) );

    JsonObject configuration = new ConfigLoader( project ).getConfiguration();

    assertEquals( 1, configuration.get( "a" ).asInt() );
    assertEquals( 1, configuration.get( "b" ).asInt() );
    assertNull( configuration.get( "c" ) );
  }
View Full Code Here

public class OptionParserUtil_Test {

  @Test
  public void createConfiguration() {
    JsonObject result = OptionParserUtil.createConfiguration( "foo: true", "org: false" );

    assertEquals( "{\"foo\":true,\"globals\":{\"org\":false}}", result.toString() );
  }
View Full Code Here

    assertEquals( "{\"foo\":true,\"globals\":{\"org\":false}}", result.toString() );
  }

  @Test
  public void createConfiguration_withEmptyParameters() {
    JsonObject result = OptionParserUtil.createConfiguration( "", "" );

    assertEquals( "{}", result.toString() );
  }
View Full Code Here

  public void fallsBackToOldProjectProperties_ifConfigFileMissing() {
    projectPrefs.setProjectSpecific( true );
    projectPrefs.getNode().put( "options", "a: 1" );
    projectPrefs.getNode().put( "globals", "foo: true" );

    JsonObject configuration = new ConfigLoader( project ).getConfiguration();

    assertEquals( 1, configuration.get( "a" ).asInt() );
    assertTrue( configuration.get( "globals" ).asObject().get( "foo" ).asBoolean() );
  }
View Full Code Here

  @Test
  public void ignoresOldProjectProperties_ifConfigFilePresent() {
    projectPrefs.setProjectSpecific( true );
    projectPrefs.getNode().put( "options", "a: 1, b: 1" );
    createProjectConfig( new JsonObject().add( "b", 2 ).add( "c", 2 ) );

    JsonObject configuration = new ConfigLoader( project ).getConfiguration();

    assertNull( configuration.get( "a" ) );
    assertEquals( 2, configuration.get( "b" ).asInt() );
    assertEquals( 2, configuration.get( "c" ).asInt() );
  }
View Full Code Here

TOP

Related Classes of com.eclipsesource.json.JsonObject$Member

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.