### Question:
JsonFunctions { public static <T> Function<Maybe<JsonElement>, T> castM(final Class<T> expected) { return Functionals.chain(MaybeFunctions.<JsonElement>get(), cast(expected)); } 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);  }### Answer:
@Test(expectedExceptions=IllegalStateException.class) public void testCastMWhenAbsent() { Maybe<JsonElement> m = Maybe.absent(); JsonFunctions.castM(String.class).apply(m); }