source: trunk/autoquest-core-assertions/src/main/java/de/ugoe/cs/autoquest/assertions/FileEqualsReplay.java @ 922

Last change on this file since 922 was 922, checked in by sherbold, 12 years ago
  • renaming of packages from de.ugoe.cs.quest to de.ugoe.cs.autoquest
  • Property svn:mime-type set to text/plain
File size: 2.4 KB
Line 
1package de.ugoe.cs.autoquest.assertions;
2
3import de.ugoe.cs.autoquest.IReplayDecorator;
4import de.ugoe.cs.autoquest.eventcore.IReplayable;
5import de.ugoe.cs.util.StringTools;
6
7/**
8 * <p>
9 * This class defines the replay for file equals assertions.
10 * </p>
11 *
12 * @author Jeffrey Hall, Steffen Herbold
13 * @version 2.0
14 */
15public class FileEqualsReplay implements IReplayable {
16
17    /**
18     * <p>
19     * The file that should be equal to expectedFile.
20     * </p>
21     */
22    protected final String actualFile;
23
24    /**
25     * <p>
26     * The file that is used as the reference.
27     * </p>
28     */
29    protected final String expectedFile;
30
31    /**
32     * <p>
33     * Id for object serialization.
34     * </p>
35     */
36    private static final long serialVersionUID = 1L;
37
38    /**
39     * <p>
40     * Constructor. Creates a new FileEqualsReplay.
41     * </p>
42     *
43     * @param expectedFile
44     *            name and path of the expected file
45     * @param actualFile
46     *            name and path of the actual file
47     * @throws IllegalArgumentException
48     *             thrown if expectedFile or actualFile are null
49     */
50    public FileEqualsReplay(String expectedFile, String actualFile) {
51        if (expectedFile == null) {
52            throw new IllegalArgumentException("expected file must not be null");
53        }
54        if (actualFile == null) {
55            throw new IllegalArgumentException("actual file must not be null");
56        }
57        this.expectedFile = expectedFile;
58        this.actualFile = actualFile;
59    }
60
61    /*
62     * (non-Javadoc)
63     *
64     * @see de.ugoe.cs.autoquest.eventcore.IReplayable#getReplay()
65     */
66    public String getReplay() {
67
68        String actualFileTmp = StringTools.xmlEntityReplacement(actualFile);
69        String expectedFileTmp = StringTools.xmlEntityReplacement(expectedFile);
70
71        StringBuilder currentMsgStr = new StringBuilder(800);
72        currentMsgStr.append("  <fileEquals ");
73        currentMsgStr.append("actualFile=\"" + actualFileTmp + "\" ");
74        currentMsgStr.append("expectedFile=\"" + expectedFileTmp + "\"/>");
75        currentMsgStr.append(StringTools.ENDLINE);
76        return currentMsgStr.toString();
77    }
78
79    /*
80     * (non-Javadoc)
81     *
82     * @see de.ugoe.cs.autoquest.eventcore.IReplayable#getDecorator()
83     */
84    @Override
85    public IReplayDecorator getDecorator() {
86        return null;
87    }
88
89}
Note: See TracBrowser for help on using the repository browser.