edu.rice.cs.util
Class LogTest
java.lang.Object
junit.framework.Assert
junit.framework.TestCase
edu.rice.cs.drjava.DrJavaTestCase
edu.rice.cs.drjava.model.MultiThreadedTestCase
edu.rice.cs.util.LogTest
- All Implemented Interfaces:
- Test
public class LogTest
- extends MultiThreadedTestCase
Test cases for Log
.
- Version:
- $Id: LogTest.java 4691 2008-12-02 23:33:27Z dlsmith $
Field Summary |
static int |
TOL
|
Method Summary |
void |
testConcurrentWrites()
Attempts to test Log's behavior when called concurrently from several sources. |
void |
testExceptionPrinting()
Tests the Exception printing methods in the Log file by throwing two exceptions and using the two types of log
methods (one with the Throwable itself and the other with the the StackTraceElement[]) |
void |
testLog()
Adds a couple of generic messages to a log, and then tests to make sure they are all correct, in the correct order,
and their timestamps are within the past few seconds. |
Methods inherited from class junit.framework.Assert |
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format |
TOL
public static final int TOL
- See Also:
- Constant Field Values
LogTest
public LogTest()
testLog
public void testLog()
throws IOException
- Adds a couple of generic messages to a log, and then tests to make sure they are all correct, in the correct order,
and their timestamps are within the past few seconds.
- Throws:
IOException
testExceptionPrinting
public void testExceptionPrinting()
throws IOException
- Tests the Exception printing methods in the Log file by throwing two exceptions and using the two types of log
methods (one with the Throwable itself and the other with the the StackTraceElement[])
- Throws:
IOException
testConcurrentWrites
public void testConcurrentWrites()
throws IOException,
InterruptedException
- Attempts to test Log's behavior when called concurrently from several sources. Spawns NUM_THREADS LogTestThreads
(see above)that wait a random number between 0 and DELAY milliseconds and then log a message. The function tests
to make sure that the messages and dates are all intact (if the Log was not handling concurrent requests properly,
the entries in the log may be corrupted).
- Throws:
IOException
InterruptedException