@Test
public void testByLevel() {

    LogRecord r1 = new LogRecord(Level.INFO, Level.INFO.toString());
    LogRecord r2 = new LogRecord(Level.WARNING, Level.WARNING.toString());
    assertTrue(r1.getSequenceNumber() < r2.getSequenceNumber());
    //Level test with null thrown.
    assertRecordLessThan(r1, r2);
    //Ensure Error doesn't change primary order.
    r1.setThrown(new Error());
    r2.setThrown(null);
    assertRecordLessThan(r1, r2);
    assertEquals(Error.class, r1.getThrown().getClass());
    r2.setThrown(new Error());
    assertRecordLessThan(r1, r2);
    assertEquals(Error.class, r1.getThrown().getClass());
    r2.setThrown(new RuntimeException());
    assertRecordLessThan(r1, r2);
    assertEquals(Error.class, r1.getThrown().getClass());
    r2.setThrown(new Exception());
    assertRecordLessThan(r1, r2);
    assertEquals(Error.class, r1.getThrown().getClass());
    r2.setThrown(new InterruptedException());
    assertRecordLessThan(r1, r2);
    //Ensure RuntimeException doesn't change primary order.
    r1.setThrown(new RuntimeException());
    r2.setThrown(null);
    assertRecordLessThan(r1, r2);
    assertEquals(RuntimeException.class, r1.getThrown().getClass());
    r2.setThrown(new Error());
    assertRecordLessThan(r1, r2);
    assertEquals(RuntimeException.class, r1.getThrown().getClass());
    r2.setThrown(new RuntimeException());
    assertRecordLessThan(r1, r2);
    assertEquals(RuntimeException.class, r1.getThrown().getClass());
    r2.setThrown(new Exception());
    assertRecordLessThan(r1, r2);
    assertEquals(RuntimeException.class, r1.getThrown().getClass());
    r2.setThrown(new InterruptedException());
    assertRecordLessThan(r1, r2);
    //Ensure Exception doesn't change primary order.
    r1.setThrown(new Exception());
    r2.setThrown(null);
    assertRecordLessThan(r1, r2);
    assertEquals(Exception.class, r1.getThrown().getClass());
    r2.setThrown(new Error());
    assertRecordLessThan(r1, r2);
    assertEquals(Exception.class, r1.getThrown().getClass());
    r2.setThrown(new RuntimeException());
    assertRecordLessThan(r1, r2);
    assertEquals(Exception.class, r1.getThrown().getClass());
    r2.setThrown(new Exception());
    assertRecordLessThan(r1, r2);
    assertEquals(Exception.class, r1.getThrown().getClass());
    r2.setThrown(new InterruptedException());
    assertRecordLessThan(r1, r2);
    //Ensure thrown and sequence doesn't change primary order.
    swapSeq(r1, r2);
    assertTrue(r1.getSequenceNumber() > r2.getSequenceNumber());
    assertRecordLessThan(r1, r2);
    r1.setThrown(null);
    r2.setThrown(null);
    assertTrue(r1.getSequenceNumber() > r2.getSequenceNumber());
    assertRecordLessThan(r1, r2);
}