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