edu.rice.cs.util
Class LogTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by edu.rice.cs.drjava.DrJavaTestCase
              extended by edu.rice.cs.drjava.model.MultiThreadedTestCase
                  extended by 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
           
 
Fields inherited from class edu.rice.cs.drjava.model.MultiThreadedTestCase
_testFailed
 
Fields inherited from class edu.rice.cs.drjava.DrJavaTestCase
TEST_DRJAVA_CONFIG_PROPERTY
 
Constructor Summary
LogTest()
           
 
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 edu.rice.cs.drjava.model.MultiThreadedTestCase
join, listenerFail, setUp, tearDown, wait
 
Methods inherited from class edu.rice.cs.drjava.DrJavaTestCase
setConfigSetting, setDocText
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TOL

public static final int TOL
See Also:
Constant Field Values
Constructor Detail

LogTest

public LogTest()
Method Detail

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