ProjectedJsonObject extends JsonObject { @Override void maybe(String key, Consumer<JsonValue> consumer) { if (isVisibleKey(key)) { original.maybe(key, consumer); } } ProjectedJsonObject(JsonObject original, Set<String> hiddenKeys); @Override Set<String> keySet(); @Override Object get(String name);  }
@Test public void maybeSucceeds() { assertTrue(createSubject().maybe("not").isPresent()); }
@Test public void maybeHidesHiddenKeys() { assertFalse(createSubject().maybe("minimum").isPresent()); }
@Test public void maybeWithConsumerHidesHiddenKeys() { Consumer<JsonValue> consumer = mock(Consumer.class); createSubject().maybe("minimum", consumer); verify(consumer, never()).accept(any()); }