### Question:
PrintPreview { protected List<TextRow> splitLongTextRow(TextRow textRow) { List<TextRow> result = new ArrayList<>(); PrinterFont font = getFont(textRow.getPrinterFontId()); String line = textRow.getText(); String remaining = ""; while (line.length() > 0) { if (line.length() > font.getNumColumns()) { remaining = line.charAt(line.length() - 1) + remaining; line = line.substring(0, line.length() - 1); } else { TextRow newRow = new TextRow(line) .align(textRow.getAlignmentStyle()) .fontStyle(textRow.getFontStyle()) .underline(textRow.getUnderlineStyle()) .setFont(font); result.add(newRow); line = remaining; remaining = ""; } } return result; } PrintPreview(PrintPayload printPayload, PrinterSettings printerSettings); Bitmap getBitmap(); Bitmap getScaledBitmap(Context context); byte[] getCompressedBitmap(); int determineHeight();  }### Answer:
@Test public void willSplitLongLineCorrectly() { PrintPayload payload = new PrintPayload(); TextRow row = payload.append("this is a very long line of text that should be split across multiple lines"); PrintPreview printPreview = new PrintPreview(payload, getPrinterSettings()); List<TextRow> rows = printPreview.splitLongTextRow(row); assertThat(rows).hasSize(2); assertThat(rows.get(0).getText()).isEqualTo("this is a very long line of text that should be "); assertThat(rows.get(1).getText()).isEqualTo("split across multiple lines"); assertThat(rows.get(0).getText().length()).isLessThanOrEqualTo(FONT_A.getNumColumns()); assertThat(rows.get(1).getText().length()).isLessThanOrEqualTo(FONT_A.getNumColumns()); }