1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 package net.grinder.tools.tcpproxy;
24
25 import junit.framework.TestCase;
26
27 import net.grinder.testutility.AssertUtilities;
28
29
30
31
32
33
34
35 public class TestCommentSourceImplementation extends TestCase {
36
37
38
39
40
41
42 public void testAddGetComments() throws Exception {
43 String[] comments = new String[] { "BEGIN Enter home URL",
44 "END Enter home URL", "BEGIN Click Sign In", "END Click Sign In",
45 "BEGIN Click Read Mails", "END Click Read Mails", };
46
47 CommentSourceImplementation csi = new CommentSourceImplementation();
48
49 AssertUtilities.assertArraysEqual(new String[0], csi.getComments());
50
51 csi.addComment(comments[0]);
52 assertEquals(comments[0], csi.getComments()[0]);
53 AssertUtilities.assertArraysEqual(new String[0], csi.getComments());
54
55 csi.addComment(comments[1]);
56 assertEquals(comments[1], csi.getComments()[0]);
57 AssertUtilities.assertArraysEqual(new String[0], csi.getComments());
58
59 csi.addComment(comments[2]);
60 csi.addComment(comments[3]);
61 csi.addComment(comments[4]);
62
63 String[] currentComments = csi.getComments();
64
65 assertEquals(comments[2], currentComments[0]);
66 assertEquals(comments[3], currentComments[1]);
67 assertEquals(comments[4], currentComments[2]);
68
69 AssertUtilities.assertArraysEqual(new String[0], csi.getComments());
70 AssertUtilities.assertArraysEqual(new String[0], csi.getComments());
71
72 csi.addComment(comments[5]);
73 assertEquals(comments[5], csi.getComments()[0]);
74 AssertUtilities.assertArraysEqual(new String[0], csi.getComments());
75
76 }
77 }