void () { String in = """ class SomePageObject { @FindBy(name = "first-name") private WebElement name; @FindBy(name = "first-name") private WebElement firstName; } class SomePageObject2 { @FindBy(name = "last-name") private WebElement name; @FindBy(name = "first-name") private WebElement firstName; }"""; assertEquals("find repeated annotation value", 1, findMatchesCount(in, """ class '_Class { @FindBy(name='_value) '_FieldType '_field = '_init?; @FindBy(name='_value) '_FieldType2 'field2 = '_init2?; }""")); in = """ class X {{ int[] newQueue = new int[queue.length * 2 - fwd]; System.arraycopy(queue, fwd, newQueue, 0, queue.length - fwd); }}"""; assertEquals("should not match because the p var differs", 0, findMatchesCount(in, "int[] '_params = new int['_p - '_i];\n" + "System.arraycopy('_a, '_i, '_params, 0, '_p - '_i);")); assertEquals(1, findMatchesCount(in, "int[] '_params = new int['_p * 2 - '_i];\n" + "System.arraycopy('_a, '_i, '_params, 0, '_p - '_i);")); in = """ class X { @Test(expected=IllegalArgumentException.class) public void testIt() throws IllegalArgumentException { System.out.println(); System.out.println(); } @Test(expected=IllegalArgumentException.class) public void testIt() throws NullPointerException { System.out.println(); System.out.println(); } } """; assertEquals(1, findMatchesCount(in, """ @Test(expected='_E.class) public void '_m() throws '_E { '_st*; } """)); }