JsonFunctions { public static Function<String, JsonElement> asJson() { return new AsJson(); } private  JsonFunctions(); static Function<String, JsonElement> asJson(); static Function<JsonElement, List<T>> forEach(final Function<JsonElement, T> func); static Function<JsonElement, JsonElement> walk(String elementOrDotSeparatedElements); static Function<JsonElement, JsonElement> walk(final String... elements); static Function<JsonElement, JsonElement> walk(final Iterable<String> elements); static Function<JsonElement, JsonElement> walkN(@Nullable String elements); static Function<JsonElement, JsonElement> walkN(final String... elements); static Function<JsonElement, JsonElement> walkN(final Iterable<String> elements); static Function<Maybe<JsonElement>, Maybe<JsonElement>> walkM(@Nullable String elements); static Function<Maybe<JsonElement>, Maybe<JsonElement>> walkM(final String... elements); static Function<Maybe<JsonElement>, Maybe<JsonElement>> walkM(final Iterable<String> elements); static Function<JsonElement,T> getPath(final String path); static Function<JsonElement, T> cast(final Class<T> expected); static Function<Maybe<JsonElement>, T> castM(final Class<T> expected); static Function<Maybe<JsonElement>, T> castM(final Class<T> expected, final T defaultValue);  }
@Test public void testAsJson() { JsonElement jsonElement = europeMap(); String jsonString = jsonElement.toString(); JsonElement result = JsonFunctions.asJson().apply(jsonString); Assert.assertEquals(result.toString(), jsonString); }
@Test public void testAsJsonWithNullReturnsNull() { Assert.assertNull(JsonFunctions.asJson().apply(null)); }