[927] | 1 | // Copyright 2012 Georg-August-Universität Göttingen, Germany
|
---|
| 2 | //
|
---|
| 3 | // Licensed under the Apache License, Version 2.0 (the "License");
|
---|
| 4 | // you may not use this file except in compliance with the License.
|
---|
| 5 | // You may obtain a copy of the License at
|
---|
| 6 | //
|
---|
| 7 | // http://www.apache.org/licenses/LICENSE-2.0
|
---|
| 8 | //
|
---|
| 9 | // Unless required by applicable law or agreed to in writing, software
|
---|
| 10 | // distributed under the License is distributed on an "AS IS" BASIS,
|
---|
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
| 12 | // See the License for the specific language governing permissions and
|
---|
| 13 | // limitations under the License.
|
---|
| 14 |
|
---|
[922] | 15 | package de.ugoe.cs.autoquest.assertions;
|
---|
[518] | 16 |
|
---|
[922] | 17 | import de.ugoe.cs.autoquest.IReplayDecorator;
|
---|
| 18 | import de.ugoe.cs.autoquest.eventcore.IReplayable;
|
---|
[518] | 19 | import de.ugoe.cs.util.StringTools;
|
---|
| 20 |
|
---|
| 21 | /**
|
---|
| 22 | * <p>
|
---|
| 23 | * This class defines the replay for file equals assertions.
|
---|
| 24 | * </p>
|
---|
| 25 | *
|
---|
| 26 | * @author Jeffrey Hall, Steffen Herbold
|
---|
| 27 | * @version 2.0
|
---|
| 28 | */
|
---|
| 29 | public class FileEqualsReplay implements IReplayable {
|
---|
| 30 |
|
---|
[559] | 31 | /**
|
---|
| 32 | * <p>
|
---|
| 33 | * The file that should be equal to expectedFile.
|
---|
| 34 | * </p>
|
---|
| 35 | */
|
---|
| 36 | protected final String actualFile;
|
---|
[518] | 37 |
|
---|
[559] | 38 | /**
|
---|
| 39 | * <p>
|
---|
| 40 | * The file that is used as the reference.
|
---|
| 41 | * </p>
|
---|
| 42 | */
|
---|
| 43 | protected final String expectedFile;
|
---|
[518] | 44 |
|
---|
[559] | 45 | /**
|
---|
| 46 | * <p>
|
---|
| 47 | * Id for object serialization.
|
---|
| 48 | * </p>
|
---|
| 49 | */
|
---|
| 50 | private static final long serialVersionUID = 1L;
|
---|
[518] | 51 |
|
---|
[559] | 52 | /**
|
---|
| 53 | * <p>
|
---|
| 54 | * Constructor. Creates a new FileEqualsReplay.
|
---|
| 55 | * </p>
|
---|
| 56 | *
|
---|
| 57 | * @param expectedFile
|
---|
| 58 | * name and path of the expected file
|
---|
| 59 | * @param actualFile
|
---|
| 60 | * name and path of the actual file
|
---|
[766] | 61 | * @throws IllegalArgumentException
|
---|
[559] | 62 | * thrown if expectedFile or actualFile are null
|
---|
| 63 | */
|
---|
| 64 | public FileEqualsReplay(String expectedFile, String actualFile) {
|
---|
| 65 | if (expectedFile == null) {
|
---|
[766] | 66 | throw new IllegalArgumentException("expected file must not be null");
|
---|
[559] | 67 | }
|
---|
| 68 | if (actualFile == null) {
|
---|
[766] | 69 | throw new IllegalArgumentException("actual file must not be null");
|
---|
[559] | 70 | }
|
---|
| 71 | this.expectedFile = expectedFile;
|
---|
| 72 | this.actualFile = actualFile;
|
---|
| 73 | }
|
---|
[518] | 74 |
|
---|
[559] | 75 | /*
|
---|
| 76 | * (non-Javadoc)
|
---|
| 77 | *
|
---|
[922] | 78 | * @see de.ugoe.cs.autoquest.eventcore.IReplayable#getReplay()
|
---|
[559] | 79 | */
|
---|
| 80 | public String getReplay() {
|
---|
[518] | 81 |
|
---|
[559] | 82 | String actualFileTmp = StringTools.xmlEntityReplacement(actualFile);
|
---|
| 83 | String expectedFileTmp = StringTools.xmlEntityReplacement(expectedFile);
|
---|
[518] | 84 |
|
---|
[559] | 85 | StringBuilder currentMsgStr = new StringBuilder(800);
|
---|
| 86 | currentMsgStr.append(" <fileEquals ");
|
---|
| 87 | currentMsgStr.append("actualFile=\"" + actualFileTmp + "\" ");
|
---|
| 88 | currentMsgStr.append("expectedFile=\"" + expectedFileTmp + "\"/>");
|
---|
| 89 | currentMsgStr.append(StringTools.ENDLINE);
|
---|
| 90 | return currentMsgStr.toString();
|
---|
| 91 | }
|
---|
[518] | 92 |
|
---|
[560] | 93 | /*
|
---|
| 94 | * (non-Javadoc)
|
---|
| 95 | *
|
---|
[922] | 96 | * @see de.ugoe.cs.autoquest.eventcore.IReplayable#getDecorator()
|
---|
[560] | 97 | */
|
---|
| 98 | @Override
|
---|
| 99 | public IReplayDecorator getDecorator() {
|
---|
| 100 | return null;
|
---|
| 101 | }
|
---|
| 102 |
|
---|
[518] | 103 | }
|
---|