EPNValidator { protected static boolean validateNetwork(Network epn, EPNValidationListener l) { boolean ret=true; if (epn.getName() == null) { l.error(epn, epn, MessageFormat.format(java.util.PropertyResourceBundle.getBundle( "epn-core.Messages").getString("EPN-CORE-6"), "Network", "name")); ret = false; } if (epn.getVersion() == null) { l.error(epn, epn, MessageFormat.format(java.util.PropertyResourceBundle.getBundle( "epn-core.Messages").getString("EPN-CORE-6"), "Network", "version")); ret = false; } return (ret); } private  EPNValidator(); static boolean validate(Network epn, EPNValidationListener l);  }
@Test public void testValidateNetwork() { Network epn=new Network(); epn.setName("network"); epn.setVersion("version"); TestListener l=new TestListener(); if (!EPNValidator.validateNetwork(epn, l)) { fail("Should be valid"); } String[] expected=new String[] { }; validateIssues(expected, l.getIssues()); }
@Test public void testValidateEmptyNetwork() { Network epn=new Network(); TestListener l=new TestListener(); if (EPNValidator.validateNetwork(epn, l)) { fail("Should be invalid"); } String[] expected=new String[] { MessageFormat.format(java.util.PropertyResourceBundle.getBundle( "epn-core.Messages").getString("EPN-CORE-6"), "Network", "name"), MessageFormat.format(java.util.PropertyResourceBundle.getBundle( "epn-core.Messages").getString("EPN-CORE-6"), "Network", "version") }; validateIssues(expected, l.getIssues()); }