FilterMetadata { FilterMetadata(BiPredicate<String, Node> predicate) { this.predicate = (entry) -> predicate.test(entry.getKey(), entry.getValue()); } FilterMetadata(BiPredicate<String, Node> predicate);   }
@Test public void filtersMetadata() { Model model = Model.builder() .putMetadataProperty("foo", Node.from("string")) .putMetadataProperty("baz", Node.from(1)) .putMetadataProperty("lorem", Node.from(true)) .build(); ModelTransformer transformer = ModelTransformer.create(); Model result = transformer.filterMetadata(model, (k, v) -> !v.isBooleanNode() && !v.isNumberNode()); assertThat(result.getMetadata().get("foo"), Matchers.equalTo(Node.from("string"))); assertThat(result.getMetadata().get("baz"), Matchers.nullValue()); assertThat(result.getMetadata().get("lorem"), Matchers.nullValue()); }