1 | // Copyright 2012 Georg-August-Universität Göttingen, Germany
|
---|
2 | //
|
---|
3 | // Licensed under the Apache License, Version 2.0 (the "License");
|
---|
4 | // you may not use this file except in compliance with the License.
|
---|
5 | // You may obtain a copy of the License at
|
---|
6 | //
|
---|
7 | // http://www.apache.org/licenses/LICENSE-2.0
|
---|
8 | //
|
---|
9 | // Unless required by applicable law or agreed to in writing, software
|
---|
10 | // distributed under the License is distributed on an "AS IS" BASIS,
|
---|
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
12 | // See the License for the specific language governing permissions and
|
---|
13 | // limitations under the License.
|
---|
14 |
|
---|
15 | package de.ugoe.cs.autoquest.assertions;
|
---|
16 |
|
---|
17 | import org.junit.*;
|
---|
18 |
|
---|
19 | import de.ugoe.cs.autoquest.assertions.TextEqualsReplay;
|
---|
20 | import static org.junit.Assert.*;
|
---|
21 |
|
---|
22 | /**
|
---|
23 | * The class <code>TextEqualsReplayTest</code> contains tests for the class
|
---|
24 | * <code>{@link TextEqualsReplay}</code>.
|
---|
25 | *
|
---|
26 | * @author Steffen Herbold
|
---|
27 | * @version 1.0
|
---|
28 | */
|
---|
29 | public class TextEqualsReplayTest {
|
---|
30 |
|
---|
31 | private final static String ENDLINE = System.getProperty("line.separator");
|
---|
32 |
|
---|
33 | @Test
|
---|
34 | public void testTextEqualsReplay_1() throws Exception {
|
---|
35 | String expectedValue = "expectedValueString";
|
---|
36 | String target = "targetString";
|
---|
37 |
|
---|
38 | TextEqualsReplay result = new TextEqualsReplay(expectedValue, target);
|
---|
39 |
|
---|
40 | assertNotNull(result);
|
---|
41 | assertEquals(expectedValue, result.expectedValue);
|
---|
42 | assertEquals(target, result.target);
|
---|
43 | }
|
---|
44 |
|
---|
45 | @Test
|
---|
46 | public void testTextEqualsReplay_2() throws Exception {
|
---|
47 | String target = "targetString";
|
---|
48 |
|
---|
49 | TextEqualsReplay result = new TextEqualsReplay(null, target);
|
---|
50 |
|
---|
51 | assertNotNull(result);
|
---|
52 | assertEquals(null, result.expectedValue);
|
---|
53 | assertEquals(target, result.target);
|
---|
54 | }
|
---|
55 |
|
---|
56 | @Test(expected = java.lang.IllegalArgumentException.class)
|
---|
57 | public void testTextEqualsReplay_3() throws Exception {
|
---|
58 | String expectedValue = "expectedValueString";
|
---|
59 |
|
---|
60 | new TextEqualsReplay(expectedValue, null);
|
---|
61 | }
|
---|
62 |
|
---|
63 | @Test
|
---|
64 | public void testGetReplay_1() throws Exception {
|
---|
65 | TextEqualsReplay fixture = new TextEqualsReplay("", "");
|
---|
66 |
|
---|
67 | String result = fixture.getReplay();
|
---|
68 |
|
---|
69 | assertEquals(" <textEquals expectedValue=\"\">" + ENDLINE + "<target>"
|
---|
70 | + ENDLINE + ENDLINE + "</target>" + ENDLINE + "</textEquals>"
|
---|
71 | + ENDLINE, result);
|
---|
72 | }
|
---|
73 |
|
---|
74 | @Test
|
---|
75 | public void testGetReplay_2() throws Exception {
|
---|
76 | TextEqualsReplay fixture = new TextEqualsReplay("expectedValueString",
|
---|
77 | "targetString");
|
---|
78 |
|
---|
79 | String result = fixture.getReplay();
|
---|
80 |
|
---|
81 | assertEquals(" <textEquals expectedValue=\"expectedValueString\">"
|
---|
82 | + ENDLINE + "<target>" + ENDLINE + "targetString" + ENDLINE
|
---|
83 | + "</target>" + ENDLINE + "</textEquals>" + ENDLINE, result);
|
---|
84 | }
|
---|
85 |
|
---|
86 | public static void main(String[] args) {
|
---|
87 | new org.junit.runner.JUnitCore().run(TextEqualsReplayTest.class);
|
---|
88 | }
|
---|
89 | } |
---|