IPValidator { protected static boolean validateContextEvaluators(InformationProcessor ip, TypeProcessor tp, IPValidationListener l) { boolean ret=true; for (ContextEvaluator ce : tp.getContexts()) { if (ce.getEvaluator() == null) { l.error(ip, ce, java.util.PropertyResourceBundle.getBundle( "activity.Messages").getString("ACTIVITY-15")); ret = false; } if (ce.getTimeframe() != 0 && ce.getType() != Type.Link) { l.error(ip, ce, java.util.PropertyResourceBundle.getBundle( "activity.Messages").getString("ACTIVITY-16")); ret = false; } } return (ret); } private  IPValidator(); static boolean validate(InformationProcessor ip, IPValidationListener l);  }
@Test public void testValidateContextEvaluator() { InformationProcessor ip=new InformationProcessor(); ip.setName("network"); ip.setVersion("version"); TypeProcessor tp=new TypeProcessor(); ip.getTypeProcessors().put("tp", tp); ContextEvaluator ce=new ContextEvaluator(); tp.getContexts().add(ce); ce.setTimeframe(100); TestListener l=new TestListener(); if (IPValidator.validateContextEvaluators(ip, tp, l)) { fail("Should be invalid"); } String[] expected=new String[] { java.util.PropertyResourceBundle.getBundle( "activity.Messages").getString("ACTIVITY-15"), java.util.PropertyResourceBundle.getBundle( "activity.Messages").getString("ACTIVITY-16") }; validateIssues(expected, l.getIssues()); }