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

Last change on this file since 229 was 229, checked in by sherbold, 13 years ago
  • Property svn:mime-type set to text/plain
File size: 1.7 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 replay for a textEquals assertion.
9 * </p>
10 *
11 * @author Jeffrey Hall, Steffen Herbold
12 * @version 2.0
13 */
14public class TextEqualsReplay implements IReplayable {
15
16        /**
17         * <p>
18         * Reference value which is compared to the targets text.
19         * </p>
20         */
21        private String expectedValue;
22
23        /**
24         * <p>
25         * Target to which the text is compared.
26         * </p>
27         */
28        private String target;
29
30        /**
31         * <p>
32         * Id for object serialization.
33         * </p>
34         */
35        private static final long serialVersionUID = 1L;
36
37        public TextEqualsReplay(String expectedValue, String target) {
38                this.expectedValue = expectedValue;
39                this.target = target;
40        }
41
42        /*
43         * (non-Javadoc)
44         *
45         * @see de.ugoe.cs.eventbench.data.IReplayable#getReplay()
46         */
47        @Override
48        public String getReplay() {
49
50                expectedValue = StringTools.xmlEntityReplacement(expectedValue);
51
52                StringBuilder currentMsgStr = new StringBuilder(400);
53                currentMsgStr.append(" <textEquals expectedValue=\"" + expectedValue
54                                + "\">");
55                currentMsgStr.append(StringTools.ENDLINE);
56                currentMsgStr.append("<target>");
57                currentMsgStr.append(StringTools.ENDLINE);
58                currentMsgStr.append(target);
59                currentMsgStr.append(StringTools.ENDLINE);
60                currentMsgStr.append("</target>");
61                currentMsgStr.append(StringTools.ENDLINE);
62                currentMsgStr.append("</textEquals>");
63                currentMsgStr.append(StringTools.ENDLINE);
64                return currentMsgStr.toString();
65        }
66
67        /*
68         * (non-Javadoc)
69         *
70         * @see de.ugoe.cs.eventbench.data.IReplayable#getTarget()
71         */
72        @Override
73        public String getTarget() {
74                return target;
75        }
76
77}
Note: See TracBrowser for help on using the repository browser.