void () { String text = "this is a test string that is expected to end just before right margin<caret>"; init(100, text); int offset = getEditor().getDocument().getTextLength() + 1; assertTrue(getSoftWrapModel().getRegisteredSoftWraps().isEmpty()); type(" thisisalongtokenthatisnotexpectedtobebrokenintopartsduringsoftwrapping"); SoftWrap softWrap = getEditor().getSoftWrapModel().getSoftWrap(offset); // This test fails randomly at TeamCity. The logging below is intended to help analyzing the problem. if (softWrap == null) { fail(String.format( "Expected soft wrap to be located on offset %d. Actual: %s. Document text: %s", offset, getSoftWrapModel().getRegisteredSoftWraps(), getEditor().getDocument().getCharsSequence() )); } }