IPValidator { protected static boolean validateInformationProcessor(InformationProcessor ip, IPValidationListener l) { boolean ret=true; if (ip.getName() == null) { l.error(ip, ip, MessageFormat.format(java.util.PropertyResourceBundle.getBundle( "activity.Messages").getString("ACTIVITY-14"), "Information Processor", "name")); ret = false; } if (ip.getVersion() == null) { l.error(ip, ip, MessageFormat.format(java.util.PropertyResourceBundle.getBundle( "activity.Messages").getString("ACTIVITY-14"), "Information Processor", "version")); ret = false; } return (ret); } private  IPValidator(); static boolean validate(InformationProcessor ip, IPValidationListener l);  }
@Test public void testValidateInformationProcessor() { InformationProcessor ip=new InformationProcessor(); ip.setName("network"); ip.setVersion("version"); TestListener l=new TestListener(); if (!IPValidator.validateInformationProcessor(ip, l)) { fail("Should be valid"); } String[] expected=new String[] { }; validateIssues(expected, l.getIssues()); }
@Test public void testValidateEmptyInformationProcessor() { InformationProcessor ip=new InformationProcessor(); TestListener l=new TestListener(); if (IPValidator.validateInformationProcessor(ip, l)) { fail("Should be invalid"); } String[] expected=new String[] { MessageFormat.format(java.util.PropertyResourceBundle.getBundle( "activity.Messages").getString("ACTIVITY-14"), "Information Processor", "name"), MessageFormat.format(java.util.PropertyResourceBundle.getBundle( "activity.Messages").getString("ACTIVITY-14"), "Information Processor", "version") }; validateIssues(expected, l.getIssues()); }