1 | package de.ugoe.cs.quest.assertions;
|
---|
2 |
|
---|
3 | import org.junit.*;
|
---|
4 |
|
---|
5 | import de.ugoe.cs.quest.assertions.TextEqualsReplay;
|
---|
6 | import static org.junit.Assert.*;
|
---|
7 |
|
---|
8 | /**
|
---|
9 | * The class <code>TextEqualsReplayTest</code> contains tests for the class
|
---|
10 | * <code>{@link TextEqualsReplay}</code>.
|
---|
11 | *
|
---|
12 | * @author Steffen Herbold
|
---|
13 | * @version 1.0
|
---|
14 | */
|
---|
15 | public class TextEqualsReplayTest {
|
---|
16 |
|
---|
17 | private final static String ENDLINE = System.getProperty("line.separator");
|
---|
18 |
|
---|
19 | @Test
|
---|
20 | public void testTextEqualsReplay_1() throws Exception {
|
---|
21 | String expectedValue = "expectedValueString";
|
---|
22 | String target = "targetString";
|
---|
23 |
|
---|
24 | TextEqualsReplay result = new TextEqualsReplay(expectedValue, target);
|
---|
25 |
|
---|
26 | assertNotNull(result);
|
---|
27 | assertEquals(expectedValue, result.expectedValue);
|
---|
28 | assertEquals(target, result.target);
|
---|
29 | }
|
---|
30 |
|
---|
31 | @Test
|
---|
32 | public void testTextEqualsReplay_2() throws Exception {
|
---|
33 | String target = "targetString";
|
---|
34 |
|
---|
35 | TextEqualsReplay result = new TextEqualsReplay(null, target);
|
---|
36 |
|
---|
37 | assertNotNull(result);
|
---|
38 | assertEquals(null, result.expectedValue);
|
---|
39 | assertEquals(target, result.target);
|
---|
40 | }
|
---|
41 |
|
---|
42 | @Test(expected = java.lang.IllegalArgumentException.class)
|
---|
43 | public void testTextEqualsReplay_3() throws Exception {
|
---|
44 | String expectedValue = "expectedValueString";
|
---|
45 |
|
---|
46 | new TextEqualsReplay(expectedValue, null);
|
---|
47 | }
|
---|
48 |
|
---|
49 | @Test
|
---|
50 | public void testGetReplay_1() throws Exception {
|
---|
51 | TextEqualsReplay fixture = new TextEqualsReplay("", "");
|
---|
52 |
|
---|
53 | String result = fixture.getReplay();
|
---|
54 |
|
---|
55 | assertEquals(" <textEquals expectedValue=\"\">" + ENDLINE + "<target>"
|
---|
56 | + ENDLINE + ENDLINE + "</target>" + ENDLINE + "</textEquals>"
|
---|
57 | + ENDLINE, result);
|
---|
58 | }
|
---|
59 |
|
---|
60 | @Test
|
---|
61 | public void testGetReplay_2() throws Exception {
|
---|
62 | TextEqualsReplay fixture = new TextEqualsReplay("expectedValueString",
|
---|
63 | "targetString");
|
---|
64 |
|
---|
65 | String result = fixture.getReplay();
|
---|
66 |
|
---|
67 | assertEquals(" <textEquals expectedValue=\"expectedValueString\">"
|
---|
68 | + ENDLINE + "<target>" + ENDLINE + "targetString" + ENDLINE
|
---|
69 | + "</target>" + ENDLINE + "</textEquals>" + ENDLINE, result);
|
---|
70 | }
|
---|
71 |
|
---|
72 | @Test
|
---|
73 | public void testGetTarget_1() throws Exception {
|
---|
74 | TextEqualsReplay fixture = new TextEqualsReplay("expectedValueString",
|
---|
75 | "targetString");
|
---|
76 |
|
---|
77 | String result = fixture.getTarget();
|
---|
78 |
|
---|
79 | assertEquals("targetString", result);
|
---|
80 | }
|
---|
81 |
|
---|
82 | public static void main(String[] args) {
|
---|
83 | new org.junit.runner.JUnitCore().run(TextEqualsReplayTest.class);
|
---|
84 | }
|
---|
85 | } |
---|