[559] | 1 |
|
---|
[518] | 2 | package de.ugoe.cs.quest.assertions;
|
---|
| 3 |
|
---|
| 4 | import java.security.InvalidParameterException;
|
---|
| 5 |
|
---|
[560] | 6 | import de.ugoe.cs.quest.IReplayDecorator;
|
---|
[518] | 7 | import de.ugoe.cs.quest.eventcore.IReplayable;
|
---|
| 8 | import de.ugoe.cs.util.StringTools;
|
---|
| 9 |
|
---|
| 10 | /**
|
---|
| 11 | * <p>
|
---|
| 12 | * This class defines the replay for file equals assertions.
|
---|
| 13 | * </p>
|
---|
| 14 | *
|
---|
| 15 | * @author Jeffrey Hall, Steffen Herbold
|
---|
| 16 | * @version 2.0
|
---|
| 17 | */
|
---|
| 18 | public class FileEqualsReplay implements IReplayable {
|
---|
| 19 |
|
---|
[559] | 20 | /**
|
---|
| 21 | * <p>
|
---|
| 22 | * The file that should be equal to expectedFile.
|
---|
| 23 | * </p>
|
---|
| 24 | */
|
---|
| 25 | protected final String actualFile;
|
---|
[518] | 26 |
|
---|
[559] | 27 | /**
|
---|
| 28 | * <p>
|
---|
| 29 | * The file that is used as the reference.
|
---|
| 30 | * </p>
|
---|
| 31 | */
|
---|
| 32 | protected final String expectedFile;
|
---|
[518] | 33 |
|
---|
[559] | 34 | /**
|
---|
| 35 | * <p>
|
---|
| 36 | * Id for object serialization.
|
---|
| 37 | * </p>
|
---|
| 38 | */
|
---|
| 39 | private static final long serialVersionUID = 1L;
|
---|
[518] | 40 |
|
---|
[559] | 41 | /**
|
---|
| 42 | * <p>
|
---|
| 43 | * Constructor. Creates a new FileEqualsReplay.
|
---|
| 44 | * </p>
|
---|
| 45 | *
|
---|
| 46 | * @param expectedFile
|
---|
| 47 | * name and path of the expected file
|
---|
| 48 | * @param actualFile
|
---|
| 49 | * name and path of the actual file
|
---|
| 50 | * @throws InvalidParameterException
|
---|
| 51 | * thrown if expectedFile or actualFile are null
|
---|
| 52 | */
|
---|
| 53 | public FileEqualsReplay(String expectedFile, String actualFile) {
|
---|
| 54 | if (expectedFile == null) {
|
---|
| 55 | throw new InvalidParameterException("expected file must not be null");
|
---|
| 56 | }
|
---|
| 57 | if (actualFile == null) {
|
---|
| 58 | throw new InvalidParameterException("actual file must not be null");
|
---|
| 59 | }
|
---|
| 60 | this.expectedFile = expectedFile;
|
---|
| 61 | this.actualFile = actualFile;
|
---|
| 62 | }
|
---|
[518] | 63 |
|
---|
[559] | 64 | /*
|
---|
| 65 | * (non-Javadoc)
|
---|
| 66 | *
|
---|
| 67 | * @see de.ugoe.cs.quest.eventcore.IReplayable#getReplay()
|
---|
| 68 | */
|
---|
| 69 | public String getReplay() {
|
---|
[518] | 70 |
|
---|
[559] | 71 | String actualFileTmp = StringTools.xmlEntityReplacement(actualFile);
|
---|
| 72 | String expectedFileTmp = StringTools.xmlEntityReplacement(expectedFile);
|
---|
[518] | 73 |
|
---|
[559] | 74 | StringBuilder currentMsgStr = new StringBuilder(800);
|
---|
| 75 | currentMsgStr.append(" <fileEquals ");
|
---|
| 76 | currentMsgStr.append("actualFile=\"" + actualFileTmp + "\" ");
|
---|
| 77 | currentMsgStr.append("expectedFile=\"" + expectedFileTmp + "\"/>");
|
---|
| 78 | currentMsgStr.append(StringTools.ENDLINE);
|
---|
| 79 | return currentMsgStr.toString();
|
---|
| 80 | }
|
---|
[518] | 81 |
|
---|
[560] | 82 | /*
|
---|
| 83 | * (non-Javadoc)
|
---|
| 84 | *
|
---|
| 85 | * @see de.ugoe.cs.quest.eventcore.IReplayable#getDecorator()
|
---|
| 86 | */
|
---|
| 87 | @Override
|
---|
| 88 | public IReplayDecorator getDecorator() {
|
---|
| 89 | return null;
|
---|
| 90 | }
|
---|
| 91 |
|
---|
[518] | 92 | }
|
---|