ValueCheck { public Boolean checkIpPrefix(String ipPrefix){ Boolean legalValue = true; String[] valuePrefix = ipPrefix.split("/"); if (valuePrefix.length!=2){ legalValue = false; } else { if (Integer.parseInt(valuePrefix[1])>32||Integer.parseInt(valuePrefix[1])<1){ legalValue = false; } else { legalValue = checkIpAddress(valuePrefix[0]); } } return legalValue; }  boolean checkMac(String macAddress); Boolean checkIpPrefix(String ipPrefix); Boolean checkIpAddress(String ipAddress); Boolean checkTime(String time);  }
@Test public void checkIpPrefixTest()throws Exception{ String ipPrefix1="11/22/33"; Assert.assertFalse(valuecheck.checkIpPrefix(ipPrefix1)); String ipPrefix2="22/33"; Assert.assertFalse(valuecheck.checkIpPrefix(ipPrefix2)); String ipPrefix3="00:00:00:00:00:000/12"; Assert.assertFalse(valuecheck.checkIpPrefix(ipPrefix3)); String ipPrefix4="10.1.1.1/12"; Assert.assertTrue(valuecheck.checkIpPrefix(ipPrefix4)); }