### Question:
DividedStringPatternMatcher { public boolean isMatching(String given ) { if (given==null) { return false; } String target = given.toLowerCase(); String[] targetPart = splitByDivider(target); if (targetPart == null) { return false; } if (targetPart.length != patternParts.length) { return false; } boolean accepted = true; for (int i = 0; i < patternParts.length && accepted; i++) { accepted = patternParts[i].equals("*") || patternParts[i].equals(targetPart[i]); } return accepted; } DividedStringPatternMatcher(String pattern, char divider); String[] getPatternParts(); boolean isMatching(String given );  }### Answer:
@Test public void test_ipv4_matcher() { DividedStringPatternMatcher matcherToTest = new DividedStringPatternMatcher("54.*.*.*", '.'); assertFalse(matcherToTest.isMatching("1.2.3")); assertFalse(matcherToTest.isMatching("1.2.3.4")); assertFalse(matcherToTest.isMatching("55.2.3.4")); assertFalse(matcherToTest.isMatching("54")); assertFalse(matcherToTest.isMatching("")); assertFalse(matcherToTest.isMatching(null)); assertFalse(matcherToTest.isMatching("54.2.3.")); assertTrue(matcherToTest.isMatching("54.2.3.4")); assertTrue(matcherToTest.isMatching("54.2.3.255")); assertTrue(matcherToTest.isMatching("54.255.255.255")); }
@Test public void test_ipv6_matcher() { DividedStringPatternMatcher matcherToTest = new DividedStringPatternMatcher("2001:DB8:0:0:8:800:200C:*", ':'); assertFalse(matcherToTest.isMatching("2002:db8:0:0:8:800:200C:417A")); assertFalse(matcherToTest.isMatching("0:::417A")); assertFalse(matcherToTest.isMatching("2001:DB8:0:0:8:800:200C:")); assertFalse(matcherToTest.isMatching("2001:DB8::8:800:200C:417A")); assertTrue(matcherToTest.isMatching("2001:DB8:0:0:8:800:200C:417A")); assertTrue(matcherToTest.isMatching("2001:DB8:0:0:8:800:200C:417B")); }