JsonFactory { public static JsonValue newValue(final boolean value) { return value ? ImmutableJsonBoolean.TRUE : ImmutableJsonBoolean.FALSE; } private  JsonFactory(); static JsonKey newKey(final CharSequence keyValue); static JsonValue nullLiteral(); static JsonValue newValue(final boolean value); static JsonValue newValue(final int value); static JsonValue newValue(final long value); static JsonValue newValue(final double value); static JsonValue newValue(@Nullable final String jsonString); static JsonValue readFrom(final String jsonString); static JsonValue readFrom(final Reader reader); static JsonObjectBuilder newObjectBuilder(); static JsonObjectBuilder newObjectBuilder(final Iterable<JsonField> jsonFields); static JsonObject newObject(); static JsonObject newObject(final String jsonString); static JsonObject newObject(final Map<JsonKey, JsonValue> fields); static JsonObject newObject(final Iterable<JsonField> jsonFields); static JsonObject nullObject(); static JsonArrayBuilder newArrayBuilder(); static JsonArrayBuilder newArrayBuilder(final Iterable<? extends JsonValue> values); static JsonArray newArray(); static JsonArray newArray(final String jsonString); static JsonArray nullArray(); static JsonField newField(final JsonKey key, @Nullable final JsonValue value); static JsonField newField(final JsonKey key, @Nullable final JsonValue value,
            @Nullable final JsonFieldDefinition definition); static JsonPatch newPatch(final JsonPatch.Operation operation, final JsonPointer path,
            @Nullable final JsonValue value); static JsonPatch newPatch(final String jsonString); static JsonPointer emptyPointer(); static JsonPointer newPointer(final JsonKey rootLevel, final JsonKey... subLevels); static JsonPointer newPointer(final CharSequence slashDelimitedCharSequence); static JsonParseOptionsBuilder newParseOptionsBuilder(); static JsonFieldSelector emptyFieldSelector(); static JsonFieldSelector newFieldSelector(@Nullable final String fieldSelectorString,
            final JsonParseOptions options); static JsonFieldSelector newFieldSelector(final Iterable<JsonPointer> pointers); static JsonFieldSelector newFieldSelector(final JsonPointer pointer, final JsonPointer... furtherPointers); static JsonFieldSelector newFieldSelector(final CharSequence pointerString,
            final CharSequence... furtherPointerStrings); @Nullable static JsonFieldSelector parseJsonFieldSelector(@Nullable final String jsonFieldSelectorString); static JsonFieldSelector newFieldSelector(final JsonFieldDefinition fieldDefinition,
            final JsonFieldDefinition... furtherFieldDefinitions); static JsonFieldSelectorBuilder newFieldSelectorBuilder(); static JsonFieldDefinition<String> newStringFieldDefinition(final CharSequence pointer,
            final JsonFieldMarker... markers); static JsonFieldDefinition<Boolean> newBooleanFieldDefinition(final CharSequence pointer,
            final JsonFieldMarker... markers); static JsonFieldDefinition<Integer> newIntFieldDefinition(final CharSequence pointer,
            final JsonFieldMarker... markers); static JsonFieldDefinition<Long> newLongFieldDefinition(final CharSequence pointer,
            final JsonFieldMarker... markers); static JsonFieldDefinition<Double> newDoubleFieldDefinition(final CharSequence pointer,
            final JsonFieldMarker... markers); static JsonFieldDefinition<JsonArray> newJsonArrayFieldDefinition(final CharSequence pointer,
            final JsonFieldMarker... markers); static JsonFieldDefinition<JsonObject> newJsonObjectFieldDefinition(final CharSequence pointer,
            final JsonFieldMarker... markers); static JsonFieldDefinition<JsonValue> newJsonValueFieldDefinition(final CharSequence pointer,
            final JsonFieldMarker... markers); static JsonArray createJsonArray(final List<JsonValue> jsonValueList,
            @Nullable final byte[] cborRepresentation); static JsonObject createJsonObject(final Map<String, JsonField> jsonFieldMap,
            @Nullable final byte[] cborObjectRepresentation);  }
@Test public void newJsonStringFromNullReturnsNullValue() { final JsonValue jsonString = JsonFactory.newValue(null); assertThat(jsonString.isString()).isFalse(); assertThat(jsonString.isNull()).isTrue(); }
@Test public void newJsonStringReturnsExpected() { final String string = "foo"; final JsonValue jsonString = JsonFactory.newValue(string); final String expectedJsonString = "\"" + string + "\""; assertThat(jsonString.isString()).isTrue(); assertThat(jsonString.toString()).isEqualTo(expectedJsonString); }
@Test public void newValueFromTrueReturnsExpected() { final JsonValue underTest = JsonFactory.newValue(true); assertThat(underTest).isBoolean(); assertThat(underTest.asBoolean()).isTrue(); }
@Test public void newValueFromFalseReturnsExpected() { final JsonValue underTest = JsonFactory.newValue(false); assertThat(underTest).isBoolean(); assertThat(underTest.asBoolean()).isFalse(); }
@Test public void newValueFromIntReturnsExpected() { final int intValue = 42; final JsonValue underTest = JsonFactory.newValue(intValue); assertThat(underTest).isNumber(); assertThat(underTest.asInt()).isEqualTo(intValue); }
@Test public void newValueFromMaxIntReturnsExpected() { final int intValue = Integer.MAX_VALUE; final JsonValue underTest = JsonFactory.newValue(intValue); assertThat(underTest).isNumber(); assertThat(underTest.asInt()).isEqualTo(intValue); }
@Test public void newValueFromLongReturnsExpected() { final long longValue = 1337L; final JsonValue underTest = JsonFactory.newValue(longValue); assertThat(underTest).isNumber(); assertThat(underTest.asLong()).isEqualTo(longValue); }
@Test public void newValueFromMaxLongReturnsExpected() { final long longValue = Long.MAX_VALUE; final JsonValue underTest = JsonFactory.newValue(longValue); assertThat(underTest).isNumber(); assertThat(underTest.asLong()).isEqualTo(longValue); }
@Test public void newValueFromDoubleReturnsExpected() { final double doubleValue = 23.7D; final JsonValue underTest = JsonFactory.newValue(doubleValue); assertThat(underTest).isNumber(); assertThat(underTest.asDouble()).isEqualTo(doubleValue); }