@Test
public void testGroupCountAndMore_UNEXPECTED_emptyGroupsAfterEndOfTargetGroupIncluded() throws Exception {

    String input = "1xxnnnnnnnnnn";
    String regex = "(1xx())()";
    Matcher matcher = Pattern.compile(regex).matcher(input);
    assertTrue(matcher.find());
    assertEquals(3, matcher.groupCount()); // principle of the longest possible match
    {
        // offset = 1 -> "1xx" will be the match result
        MatchResultWithOffset mo = new MatchResultWithOffset(matcher, 1);
        assertGroup(-1, "1xx", 0, 3, mo);
        assertGroup(0, "1xx", 0, 3, mo);
        assertGroup(1, "", 3, 3, mo); // group "()"
        assertGroup(2, "", 3, 3, mo); // group "()" UNEXPECTED!
        assertEquals(2, mo.groupCount()); // UNEXPECTED!
    }
}