@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();
    // Remove boolean and number metadata key-value pairs.
    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());
}