### Question:
PatternMatcher { public static boolean match(Writable value, String regex) { if (value == null) { return false; } String valueStr = value.toString(); if (valueStr == null || valueStr.length() == 0) { return false; } Pattern p = Pattern.compile(regex); Matcher m = p.matcher(valueStr); return m.matches(); } private  PatternMatcher(); static boolean match(Writable value, String regex); static boolean match(Writable value, Pattern pattern); static boolean match(Writable value);  }### Answer:
@Test public void matchPatternTest() { Text value = new Text(); value.set("09/03/1989"); Pattern pattern = Pattern.compile(UtilitiesConstantsTestInterface.REGEX); boolean check = PatternMatcher.match(value, pattern); assertTrue(check); }
@Test public void matchPatternZeroLengthTest() { Text value = new Text(); value.set(""); Pattern pattern = Pattern.compile(UtilitiesConstantsTestInterface.REGEX); boolean check = PatternMatcher.match(value, pattern); assertFalse(check); }
@Test public void matchPatternNullTest() { Pattern pattern = Pattern.compile(UtilitiesConstantsTestInterface.REGEX); boolean check = PatternMatcher.match(null, pattern); assertFalse(check); }
@Test public void matchTestAgainstStringNull() { Text value = new Text(); value.set("null"); boolean check = PatternMatcher.match(value); assertFalse(check); }
@Test public void matchTestAgainstNull() { boolean check = PatternMatcher.match(null); assertTrue(check); }
@Test public void matchWithNullValue() { boolean check = PatternMatcher.match(null, UtilitiesConstantsTestInterface.REGEX); assertFalse(check); }
@Test public void matchRegexTest() { Text value = new Text(); value.set("09/03/1989"); boolean check = PatternMatcher.match(value, UtilitiesConstantsTestInterface.REGEX); assertTrue(check); }
@Test public void matchRegexZeroLengthTest() { Text value = new Text(); value.set(""); boolean check = PatternMatcher.match(value, UtilitiesConstantsTestInterface.REGEX); assertFalse(check); }