@TestFactory Collection<DynamicTest> testFactoryForCidr() { return Arrays.stream(validateCidrDataProvider()) .map(x -> DynamicTest.dynamicTest(String.format("%s should be %b", (String) x[0], (Boolean) x[1]), () -> Assertions.assertEquals(CidrValidatorHelper.isCidrPatternMatched((String) x[0]), (Boolean) x[1]))) .collect(Collectors.toList()); }
public static boolean isCidrPatternMatched(String value) { if (StringUtils.isEmpty(value)) { return false; } Pattern pattern = Pattern.compile(CIDR_REGEX); Matcher matcher = pattern.matcher(value); if (!matcher.find()) { return false; } return true; }
CidrValidatorHelper { public static boolean isCidrPatternMatched(String value) { if (StringUtils.isEmpty(value)) { return false; } Pattern pattern = Pattern.compile(CIDR_REGEX); Matcher matcher = pattern.matcher(value); if (!matcher.find()) { return false; } return true; } }
CidrValidatorHelper { public static boolean isCidrPatternMatched(String value) { if (StringUtils.isEmpty(value)) { return false; } Pattern pattern = Pattern.compile(CIDR_REGEX); Matcher matcher = pattern.matcher(value); if (!matcher.find()) { return false; } return true; } private  CidrValidatorHelper(); }
CidrValidatorHelper { public static boolean isCidrPatternMatched(String value) { if (StringUtils.isEmpty(value)) { return false; } Pattern pattern = Pattern.compile(CIDR_REGEX); Matcher matcher = pattern.matcher(value); if (!matcher.find()) { return false; } return true; } private  CidrValidatorHelper(); static boolean isCidrPatternMatched(String value); static boolean isPrefixLengthCouldBeDividedIntoSubnets(String value); }
CidrValidatorHelper { public static boolean isCidrPatternMatched(String value) { if (StringUtils.isEmpty(value)) { return false; } Pattern pattern = Pattern.compile(CIDR_REGEX); Matcher matcher = pattern.matcher(value); if (!matcher.find()) { return false; } return true; } private  CidrValidatorHelper(); static boolean isCidrPatternMatched(String value); static boolean isPrefixLengthCouldBeDividedIntoSubnets(String value); static final String CIDR_REGEX; static final String EXPECTED_NETWORK_MASK_TO_CREATE_SUBNETS_EASILY; }