source: trunk/EventBenchCore/src/de/ugoe/cs/eventbench/assertions/TextEqualsReplay.java @ 218

Last change on this file since 218 was 218, checked in by jhall, 13 years ago

Added comments and renamed some variables.

  • Property svn:mime-type set to text/plain
File size: 1.9 KB
Line 
1package de.ugoe.cs.eventbench.assertions;
2
3import de.ugoe.cs.eventbench.data.IReplayable;
4import de.ugoe.cs.util.StringTools;
5
6/**
7 * <p>
8 * This class defines the textEquals assertion type. This type does have two
9 * parameters, expectedValue and target.
10 * </p>
11 *
12 * @author jeffrey.hall
13 * @version 1.0
14 *
15 */
16public class TextEqualsReplay implements IReplayable {
17
18        /**
19         * The reference value which is compared to the targets text.
20         */
21        private String expectedValue = null;
22
23        /**
24         * The window which text is compared to expectedValue.
25         */
26        private String target = null;
27
28        /**
29         * Id for object serialization.
30         */
31        private static final long serialVersionUID = 1L;
32
33        /**
34         * @param expectedValue
35         *            The reference value which is compared to the targets text.
36         */
37        public void setExpectedValue(String expectedValue) {
38                this.expectedValue = expectedValue;
39        }
40
41        /**
42         * @param target
43         *            The window which text is compared to expectedValue.
44         */
45        public void setTarget(String target) {
46                this.target = target;
47        }
48
49        /**
50         * Returns the string that has to be written to the replay file.
51         */
52        public String getReplay() {
53
54                expectedValue = StringTools.xmlEntityReplacement(expectedValue);
55
56                StringBuilder currentMsgStr = new StringBuilder(400);
57                currentMsgStr.append(" <textEquals expectedValue=\"" + expectedValue
58                                + "\">");
59                currentMsgStr.append(StringTools.ENDLINE);
60                currentMsgStr.append("<target>");
61                currentMsgStr.append(StringTools.ENDLINE);
62                currentMsgStr.append(target);
63                currentMsgStr.append(StringTools.ENDLINE);
64                currentMsgStr.append("</target>");
65                currentMsgStr.append(StringTools.ENDLINE);
66                currentMsgStr.append("</textEquals>");
67                currentMsgStr.append(StringTools.ENDLINE);
68                return currentMsgStr.toString();
69        }
70
71        /**
72         * Returns the target window.
73         */
74        public String getTarget() {
75                return target;
76        }
77
78}
Note: See TracBrowser for help on using the repository browser.