@Test
public void testThing() {
String CODE = "runatestinatestwith\nsomemoretestsandthen\nyou'redone";
LineMatch[] matches = YourClass.getMatchingLines(CODE, Pattern.compile("test"));
assertEquals(2, matches.length);
assertEquals(5, matches[0].matchedText.size());
assertEquals("runa", matches[0].matchedText.get(0).content);
assertEquals("test", matches[0].matchedText.get(1).content);
assertEquals("ina", matches[0].matchedText.get(2).content);
assertEquals("test", matches[0].matchedText.get(3).content);
assertEquals("with", matches[0].matchedText.get(4).content);
assertEquals(3, matches[1].matchedText.size());
assertEquals("somemore", matches[1].matchedText.get(0).content);
assertEquals("test", matches[1].matchedText.get(1).content);
assertEquals("sandthen", matches[1].matchedText.get(2).content);
}
Comments
0 B
|👍
/👎