void () { String text = extractText("a.java", "//Hello. I are a very humble\n//persons.\n\nclass C {}", 4).toString(); assertTrue(text, text.matches("Hello\\. I are a very humble\\spersons\\.")); assertEquals("First line.\nThird line.", extractText("a.java", """ // First line. //\s // Third line. """ , 4).toString()); text = "//1\n//2\n//3\n//4"; PsiFile file = PsiFileFactory.getInstance(getProject()).createFileFromText("a.java", JavaFileType.INSTANCE, text); TextContent tc = TextExtractor.findTextAt(file, text.indexOf("1"), TextContent.TextDomain.ALL); assertEquals("1\n2\n3\n4", tc.toString()); assertEquals(tc, TextExtractor.findTextAt(file, text.indexOf("3"), TextContent.TextDomain.ALL)); }