### Question:
TextBreak { @Nonnull public List<String> split() { if (isSingleLine()) { return singleResult(); } return processWords(); } TextBreak(@Nonnull final String line, final int width, final RenderFont font); @Nonnull List<String> split();  }### Answer:
@Test public void testNoSplit() { expect(renderFontMock.getWidth("abcdef")).andReturn(12); replay(elementMock); replay(renderFontMock); TextBreak textBreak = new TextBreak("abcdef", 100, renderFontMock); List<String> lines = textBreak.split(); assertEquals(1, lines.size()); assertEquals("abcdef", lines.get(0)); }
@Test public void testSplit() { replay(elementMock); expect(renderFontMock.getWidth("abc")).andReturn(95); expect(renderFontMock.getWidth("def")).andReturn(95); expect(renderFontMock.getWidth(" def")).andReturn(95); replay(renderFontMock); TextBreak textBreak = new TextBreak("abc def", 100, renderFontMock); List<String> lines = textBreak.split(); assertEquals(2, lines.size()); assertEquals("abc", lines.get(0)); assertEquals("def", lines.get(1)); }
@Test public void testNoneSplit() { replay(elementMock); expect(renderFontMock.getWidth("abc")).andReturn(40); expect(renderFontMock.getWidth(" def")).andReturn(40); replay(renderFontMock); TextBreak textBreak = new TextBreak("abc def", 100, renderFontMock); List<String> lines = textBreak.split(); assertEquals(1, lines.size()); assertEquals("abc def", lines.get(0)); }