@Test
public void testFormatMaxThrowableWidthLeftToRight() {

    String fmt = LEFT_TO_RIGHT;
    int width = MAX_PRE;
    assertTrue(fmt, fmt.contains(Integer.toString(width)));
    assertTrue(String.valueOf(width), width < Integer.MAX_VALUE / 4);
    CompactFormatter cf = new CompactFormatter(fmt);
    LogRecord record = new LogRecord(Level.SEVERE, "");
    int padding = LINE_SEP.length();
    for (int i = 0; i < width; i++) {
        record.setThrown(new Throwable(rpad("", i, "A")));
        String result = cf.format(record);
        assertTrue(result, result.length() <= width + padding);
        assertTrue(result, result.endsWith(LINE_SEP));
    }
    for (int i = width; i <= (width * 4); i++) {
        record.setThrown(new Throwable(rpad("", i, "A")));
        String result = cf.format(record);
        assertTrue(result.length() + ", " + (width + padding),
                result.length() == width + padding);
        assertTrue(result, result.endsWith(LINE_SEP));
    }
}