View Javadoc

1   package com.atlassian.johnson.event;
2   
3   import java.io.PrintStream;
4   
5   import com.mockobjects.io.MockOutputStream;
6   import com.mockobjects.io.MockPrintStream;
7   
8   import junit.framework.TestCase;
9   
10  public class TestEvent extends TestCase
11  {
12      public void testToStringDoesntSysout() throws Exception
13      {
14          // don't laugh, check the revision history...
15  
16          final PrintStream out = System.out;
17          MockPrintStream mockOut = new MockPrintStream(new MockOutputStream());
18          System.setOut(mockOut);
19          try
20          {
21              Event event = new Event(new EventType("foo", "bar"), "fubar");
22              mockOut.setExpectedPrintlnCalls(0);
23              assertNotNull(event.toString());
24              mockOut.verify();
25          }
26          finally
27          {
28              System.setOut(out);
29          }
30      }
31  }