@Test public void acceptTest() { Function<Object, ValueWrapper> alwaysMatchFunction = ValueWrapper::of; FactMappingValue factMappingValue = new FactMappingValue(FactIdentifier.DESCRIPTION, ExpressionIdentifier.DESCRIPTION, "Test"); ScenarioResult scenarioResult = new ScenarioResult(factMappingValue); ConditionFilter conditionFilter = new ConditionFilter(singletonList(new FactCheckerHandle(String.class, alwaysMatchFunction, scenarioResult))); Assert.assertFalse(conditionFilter.accept(1)); Assert.assertTrue(conditionFilter.accept("String")); Function<Object, ValueWrapper> alwaysNotMatchFunction = object -> ValueWrapper.errorWithValidValue(null, null); ConditionFilter conditionFilterFail = new ConditionFilter(singletonList(new FactCheckerHandle(String.class, alwaysNotMatchFunction, scenarioResult))); Assert.assertFalse(conditionFilterFail.accept("String")); }
@Override public boolean accept(Object object) { return factToCheck.stream() .allMatch(factCheckerHandle -> factCheckerHandle.getClazz().isAssignableFrom(object.getClass()) && factCheckerHandle.getCheckFuction().apply(object).isValid()); }
ConditionFilter implements ObjectFilter { @Override public boolean accept(Object object) { return factToCheck.stream() .allMatch(factCheckerHandle -> factCheckerHandle.getClazz().isAssignableFrom(object.getClass()) && factCheckerHandle.getCheckFuction().apply(object).isValid()); } }
ConditionFilter implements ObjectFilter { @Override public boolean accept(Object object) { return factToCheck.stream() .allMatch(factCheckerHandle -> factCheckerHandle.getClazz().isAssignableFrom(object.getClass()) && factCheckerHandle.getCheckFuction().apply(object).isValid()); } ConditionFilter(List<FactCheckerHandle> factToCheck); }
ConditionFilter implements ObjectFilter { @Override public boolean accept(Object object) { return factToCheck.stream() .allMatch(factCheckerHandle -> factCheckerHandle.getClazz().isAssignableFrom(object.getClass()) && factCheckerHandle.getCheckFuction().apply(object).isValid()); } ConditionFilter(List<FactCheckerHandle> factToCheck); @Override boolean accept(Object object); }
ConditionFilter implements ObjectFilter { @Override public boolean accept(Object object) { return factToCheck.stream() .allMatch(factCheckerHandle -> factCheckerHandle.getClazz().isAssignableFrom(object.getClass()) && factCheckerHandle.getCheckFuction().apply(object).isValid()); } ConditionFilter(List<FactCheckerHandle> factToCheck); @Override boolean accept(Object object);  }