### Question:
VisibilityService { public ConditionGroup build(final ParameterMeta param) { final boolean and = "AND".equalsIgnoreCase(param.getMetadata().getOrDefault("tcomp::condition::ifs::operator", "AND")); return new ConditionGroup(param .getMetadata() .entrySet() .stream() .filter(meta -> meta.getKey().startsWith("tcomp::condition::if::target")) .map(meta -> { final String[] split = meta.getKey().split("::"); final String index = split.length == 5 ? "::" + split[split.length - 1] : ""; final String valueKey = "tcomp::condition::if::value" + index; final String negateKey = "tcomp::condition::if::negate" + index; final String evaluationStrategyKey = "tcomp::condition::if::evaluationStrategy" + index; final String absoluteTargetPath = pathResolver.resolveProperty(param.getPath(), meta.getValue()); return new Condition(toPointer(absoluteTargetPath), Boolean.parseBoolean(param.getMetadata().getOrDefault(negateKey, "false")), param.getMetadata().getOrDefault(evaluationStrategyKey, "DEFAULT").toUpperCase(ROOT), param.getMetadata().getOrDefault(valueKey, "true").split(",")); }) .collect(toList()), and ? stream -> stream.allMatch(i -> i) : stream -> stream.anyMatch(i -> i)); }  ConditionGroup build(final ParameterMeta param);  }### Answer:
@Test void one() { final Map<String, String> metadata = new HashMap<>(); metadata.put("tcomp::condition::if::target", "the_target"); metadata.put("tcomp::condition::if::value", "a,b,c"); metadata.put("tcomp::condition::if::negate", "false"); metadata.put("tcomp::condition::if::evaluationStrategy", "DEFAULT"); final VisibilityService.ConditionGroup conditionGroup = service .build(new ParameterMeta(null, String.class, ParameterMeta.Type.STRING, "foo", "foo", null, emptyList(), emptyList(), metadata, false)); assertTrue(conditionGroup.isVisible(Json.createObjectBuilder().add("the_target", "a").build())); assertTrue(conditionGroup.isVisible(Json.createObjectBuilder().add("the_target", "c").build())); assertFalse(conditionGroup.isVisible(Json.createObjectBuilder().build())); }
@Test void two() { final Map<String, String> metadata = new HashMap<>(); metadata.put("tcomp::condition::if::target::0", "the_target1"); metadata.put("tcomp::condition::if::value::0", "a,b,c"); metadata.put("tcomp::condition::if::negate::0", "false"); metadata.put("tcomp::condition::if::evaluationStrategy::0", "DEFAULT"); metadata.put("tcomp::condition::if::target::1", "the_target2"); metadata.put("tcomp::condition::if::value::1", "1"); metadata.put("tcomp::condition::if::negate::1", "true"); metadata.put("tcomp::condition::if::evaluationStrategy::1", "LENGTH"); final VisibilityService.ConditionGroup conditionGroup = service .build(new ParameterMeta(null, String.class, ParameterMeta.Type.STRING, "foo", "foo", null, emptyList(), emptyList(), metadata, false)); assertTrue(conditionGroup.isVisible(Json.createObjectBuilder().add("the_target1", "a").build())); assertTrue(conditionGroup .isVisible(Json.createObjectBuilder().add("the_target1", "a").add("the_target2", "aa").build())); assertFalse(conditionGroup .isVisible(Json.createObjectBuilder().add("the_target1", "d").add("the_target2", "a").build())); assertFalse(conditionGroup .isVisible(Json.createObjectBuilder().add("the_target1", "d").add("the_target2", "aa").build())); }