### Question:
SimonPattern implements SimonFilter { public static SimonPattern create(String pattern) { if (pattern == null) { return null; } return createForType(pattern, Simon.class); } SimonPattern(String pattern);  SimonPattern(String pattern, Class<? extends Simon> expectedType); static SimonPattern create(String pattern); static SimonPattern createForCounter(String pattern); static SimonPattern createForStopwatch(String pattern); @Override /** * Checks if Simon's name matches this pattern. * * @param simon Simon to be tested * @return true if Simon's name matches this pattern */ boolean accept(Simon simon); boolean matches(String name); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }### Answer:
@Test(expectedExceptions = SimonException.class, expectedExceptionsMessageRegExp = "Invalid Simon pattern: ") public void testEmpty() { SimonPattern.create(""); }
@Test(expectedExceptions = SimonException.class, expectedExceptionsMessageRegExp = "Invalid Simon pattern: \\*\\*") public void testDoubleWildcard() { SimonPattern.create("**"); }
@Test(expectedExceptions = SimonException.class, expectedExceptionsMessageRegExp = "Invalid Simon pattern: \\* public void testStartWildcardIllegalName() { SimonPattern.create("* }
@Test(expectedExceptions = SimonException.class, expectedExceptionsMessageRegExp = "Invalid Simon pattern: public void testEndWildcardIllegalName() { SimonPattern.create(" }
@Test(expectedExceptions = SimonException.class, expectedExceptionsMessageRegExp = "Invalid Simon pattern: \\* public void testDoubleWildcardInvalidName() { SimonPattern.create("* }
@Test public void testSameSimonPatternAreEquals() { String pattern = "*abc*"; SimonPattern pattern1 = SimonPattern.create(pattern); SimonPattern pattern2 = SimonPattern.create(pattern); Assert.assertEquals(pattern1, pattern2); }
@Test public void testDifferentSimonPatternAreNotEquals() { SimonPattern pattern1 = SimonPattern.create("*abc*"); SimonPattern pattern2 = SimonPattern.create("*cba*"); Assert.assertNotEquals(pattern1, pattern2); }