void () { final String text = """ package org.denis; public class BrokenAlignment { void method1(int a) { } Object method2(Object ... data) { return new Runnable() { public void run() { System.out.println(); } }; } }"""; init(511, text, JavaFileType.INSTANCE, 10); addCollapsedFoldRegion(text.indexOf("new Runnable"), text.indexOf("System"), "Runnable() { "); int start = text.indexOf("System"); start = text.indexOf("\n", start); int end = text.indexOf(';', start); addCollapsedFoldRegion(start, end, " }"); final List<? extends SoftWrap> wraps = getSoftWrapModel().getRegisteredSoftWraps(); assertEquals(1, wraps.size()); assertEquals(start, wraps.get(0).getStart()); assertEquals(getEditor().offsetToVisualPosition(start), getEditor().offsetToVisualPosition(start + 1)); assertEquals(getEditor().offsetToVisualPosition(start).line, getEditor().offsetToVisualPosition(end - 1).line); }