ProjectedJsonObject extends JsonObject { @Override <R> Optional<R> maybeMapping(String key, Function<JsonValue, R> fn) { if (isVisibleKey(key)) { return original.maybeMapping(key, fn); } else { return Optional.empty(); } } ProjectedJsonObject(JsonObject original, Set<String> hiddenKeys); @Override Set<String> keySet(); @Override Object get(String name);  }
@Test public void maybeMappingSucceeds() { assertTrue(createSubject().maybeMapping("not", val -> true).isPresent()); }
@Test public void maybeMappingHidesKey() { assertFalse(createSubject().maybeMapping("minimum", val -> true).isPresent()); }