ProjectedJsonObject extends JsonObject { @Override boolean isEmpty() { Set<String> origKeys = original.keySet(); return original.isEmpty() || (origKeys.containsAll(hiddenKeys) && origKeys.size() == hiddenKeys.size()); } ProjectedJsonObject(JsonObject original, Set<String> hiddenKeys); @Override Set<String> keySet(); @Override Object get(String name);  }
@Test public void isEmptyTakesHiddenKeysIntoAccount() { assertFalse(createSubject().isEmpty()); ProjectedJsonObject subject = new ProjectedJsonObject(new JsonObject(ImmutableMap.<String, Object>builder() .put("minimum", 2) .put("maximum", 20).build()), new HashSet<>(asList("minimum", "maximum"))); assertTrue(subject.isEmpty()); }