1 package org.apache.maven.cvslib;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 import junit.framework.TestCase;
22
23 import org.netbeans.lib.cvsclient.event.MessageEvent;
24
25
26 /**
27 * Test cases for {@link CvsLogListener}
28 * @author <a href="mailto:epugh@upstate.com">Eric Pugh</a>
29 * @version $Id: CvsLogListenerTest.java 532339 2007-04-25 12:28:56Z ltheussl $
30 */
31 public class CvsLogListenerTest extends TestCase
32 {
33
34
35 /**
36 * Create a test with the given name
37 * @param testName the name of the test
38 */
39 public CvsLogListenerTest(String testName)
40 {
41 super(testName);
42 }
43
44 /**
45 * Test of listening to a regular output
46 * @throws Exception when there is an unexpected problem
47 */
48 public void testNormalEvent() throws Exception
49 {
50 String MESSAGE = "I am a message";
51 CvsLogListener listener = new CvsLogListener();
52 MessageEvent me = new MessageEvent("souce",MESSAGE,false);
53 listener.messageSent(me);
54 assertTrue(listener.getStdout().toString().indexOf(MESSAGE)>-1);
55
56 }
57
58 /**
59 * Test of listening to an error
60 * @throws Exception when there is an unexpected problem
61 */
62 public void testErrorEvent() throws Exception
63 {
64 String MESSAGE = "I am a message";
65 CvsLogListener listener = new CvsLogListener();
66 MessageEvent me = new MessageEvent("souce",MESSAGE,true);
67 listener.messageSent(me);
68 assertTrue(listener.getStdout().toString().indexOf(MESSAGE)==-1);
69
70 }
71
72
73
74 }