|
10 | 10 | *******************************************************************************/ |
11 | 11 | package org.eclipse.rcptt.reporting.html.tests; |
12 | 12 |
|
| 13 | +import static org.hamcrest.CoreMatchers.not; |
13 | 14 | import static org.hamcrest.MatcherAssert.assertThat; |
| 15 | +import static org.hamcrest.Matchers.containsString; |
| 16 | +import static org.hamcrest.Matchers.stringContainsInOrder; |
14 | 17 |
|
15 | 18 | import java.io.PrintWriter; |
16 | 19 | import java.io.StringWriter; |
|
28 | 31 | import org.eclipse.rcptt.sherlock.core.model.sherlock.report.Screenshot; |
29 | 32 | import org.eclipse.rcptt.sherlock.core.model.sherlock.report.Snaphot; |
30 | 33 | import org.eclipse.rcptt.tesla.core.Q7WaitUtils; |
| 34 | +import org.eclipse.rcptt.tesla.core.info.AdvancedInformation; |
| 35 | +import org.eclipse.rcptt.tesla.core.info.InfoFactory; |
| 36 | +import org.eclipse.rcptt.tesla.core.info.InfoNode; |
| 37 | +import org.eclipse.rcptt.tesla.core.info.NodeProperty; |
31 | 38 | import org.eclipse.rcptt.verifications.status.EVerificationStatus; |
32 | 39 | import org.eclipse.rcptt.verifications.status.StatusFactory; |
33 | 40 | import org.eclipse.rcptt.verifications.status.VerificationStatusData; |
@@ -183,13 +190,47 @@ public void escapeExecutionStatus() { |
183 | 190 |
|
184 | 191 | String result = generate(report); |
185 | 192 |
|
186 | | - assertThat(result, Matchers.stringContainsInOrder( |
| 193 | + assertThat(result, stringContainsInOrder( |
187 | 194 | "Failure Reason", |
188 | 195 | "expected:<wait 200\\n> but was:<wait 200>", |
189 | 196 | "Details", |
190 | 197 | "expected:<wait 200\\n> but was:<wait 200>" |
191 | 198 | )); |
192 | 199 | } |
| 200 | + |
| 201 | + @Test |
| 202 | + public void escapeSwtSnapshot() { |
| 203 | + Report report = createReport("2", IStatus.ERROR); |
| 204 | + Snaphot sn = ReportFactory.eINSTANCE.createSnaphot(); |
| 205 | + report.getRoot().getSnapshots().add(sn); |
| 206 | + AdvancedInformation information = InfoFactory.eINSTANCE.createAdvancedInformation(); |
| 207 | + sn.setData(information); |
| 208 | + InfoNode node = InfoFactory.eINSTANCE.createInfoNode(); |
| 209 | + information.getNodes().add(node); |
| 210 | + node.setName("swt.info"); |
| 211 | + InfoNode node2 = InfoFactory.eINSTANCE.createInfoNode(); |
| 212 | + node.getChildren().add(node2); |
| 213 | + node2.setName("Text(502<html><head><title>502 Bad Gateway...)"); |
| 214 | + NodeProperty property = InfoFactory.eINSTANCE.createNodeProperty(); |
| 215 | + node2.getProperties().add(property); |
| 216 | + property.setName("<propertyName>"); |
| 217 | + property.setValue("<propertyValue>"); |
| 218 | + |
| 219 | + String result = generate(report); |
| 220 | + assertThat(result, stringContainsInOrder( |
| 221 | + "Text", |
| 222 | + "502", |
| 223 | + "502 Bad Gateway..." |
| 224 | + )); |
| 225 | + assertThat(result, not(containsString("502<"))); |
| 226 | + assertThat(result, not(containsString(">502"))); |
| 227 | + assertThat(result, containsString("502<")); |
| 228 | + assertThat(result, containsString(">502")); |
| 229 | + assertThat(result, not(containsString("<propertyName>"))); |
| 230 | + assertThat(result, not(containsString("<propertyValue>"))); |
| 231 | + assertThat(result, containsString("<propertyName>")); |
| 232 | + assertThat(result, containsString("<propertyValue>")); |
| 233 | + } |
193 | 234 |
|
194 | 235 |
|
195 | 236 |
|
|
0 commit comments