Assert.fail("no match available yet");
} catch (IllegalStateException ex) {
Assert.assertEquals("No match available", ex.getMessage());
}
Assert.assertTrue(m1.find()); // Pattern can be found, match is available
Assert.assertEquals(0, m1.regionStart()); // regionStart and regionEnd must be set using Matcher.region(start, stop)
Assert.assertEquals(1, m1.start()); // Start of this match
Assert.assertEquals("a", m1.group());
Assert.assertEquals("a", m1.group(0)); // We'll have one group with index 0 which is the whole match
Assert.assertTrue(m1.find()); // Finds the next occurence