PatternHolder { @Override public int hashCode() { return pattern.toString().hashCode(); } PatternHolder(Pattern pattern); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); Pattern getPattern();  }
@Test public void testHashCode(TestContext context) { PatternHolder pH = new PatternHolder(Pattern.compile("(mouse|cat|dog|wolf|bear|human)")); String patternStr = "(mouse|cat|dog|wolf|bear|human)"; context.assertEquals(patternStr.hashCode(), pH.hashCode()); }