Changeset 13358 in josm for trunk/test
- Timestamp:
- 2018-01-26T23:21:57+01:00 (6 years ago)
- Location:
- trunk/test
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/functional/org/openstreetmap/josm/tools/HttpClientTest.java
r12807 r13358 5 5 import static org.hamcrest.CoreMatchers.is; 6 6 import static org.hamcrest.CoreMatchers.nullValue; 7 import static org.junit.Assert.assertEquals; 7 8 import static org.junit.Assert.assertThat; 9 import static org.junit.Assert.assertTrue; 8 10 9 11 import java.io.BufferedReader; … … 15 17 import java.util.logging.Handler; 16 18 import java.util.logging.LogRecord; 19 import java.util.regex.Matcher; 17 20 18 21 import javax.json.JsonObject; … … 298 301 } 299 302 } 303 304 /** 305 * Test that error message sent by Tomcat can be parsed. 306 */ 307 @Test 308 public void testTomcatErrorMessage() { 309 Matcher m = HttpClient.getTomcatErrorMatcher( 310 "<html><head><title>Apache Tomcat/DGFiP - Rapport d''erreur</title><style><!--"+ 311 "H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} "+ 312 "H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} "+ 313 "H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} "+ 314 "BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} "+ 315 "B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} "+ 316 "P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}"+ 317 "A {color : black;}A.name {color : black;}HR {color : #525D76;}"+ 318 "--></style> </head><body><h1>Etat HTTP 400 - La commune demandée n'existe pas ou n'est pas accessible.</h1>"+ 319 "<HR size=\"1\" noshade=\"noshade\">"+ 320 "<p><b>type</b> Rapport d''état</p><p><b>message</b> <u>La commune demandée n'existe pas ou n'est pas accessible.</u></p>"+ 321 "<p><b>description</b> <u>La requête envoyée par le client était syntaxiquement incorrecte.</u></p>"+ 322 "<HR size=\"1\" noshade=\"noshade\"><h3>Apache Tomcat/DGFiP</h3></body></html>"); 323 assertTrue(m.matches()); 324 assertEquals("La commune demandée n'existe pas ou n'est pas accessible.", m.group(1)); 325 } 300 326 } -
trunk/test/unit/org/openstreetmap/josm/data/cache/JCSCachedTileLoaderJobTest.java
r13230 r13358 4 4 import static org.junit.Assert.assertEquals; 5 5 import static org.junit.Assert.assertFalse; 6 import static org.junit.Assert.assertTrue;7 6 8 7 import java.io.IOException; … … 10 9 import java.net.URL; 11 10 import java.nio.charset.StandardCharsets; 12 import java.util.regex.Matcher;13 11 14 12 import org.apache.commons.jcs.access.behavior.ICacheAccess; … … 173 171 return JCSCacheManager.getCache("test"); 174 172 } 175 176 /**177 * Test that error message sent by Tomcat can be parsed.178 */179 @Test180 public void testTomcatErrorMessage() {181 Matcher m = JCSCachedTileLoaderJob.TOMCAT_ERR_MESSAGE.matcher(182 "<html><head><title>Apache Tomcat/DGFiP - Rapport d''erreur</title><style><!--"+183 "H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} "+184 "H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} "+185 "H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} "+186 "BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} "+187 "B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} "+188 "P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}"+189 "A {color : black;}A.name {color : black;}HR {color : #525D76;}"+190 "--></style> </head><body><h1>Etat HTTP 400 - La commune demandée n'existe pas ou n'est pas accessible.</h1>"+191 "<HR size=\"1\" noshade=\"noshade\">"+192 "<p><b>type</b> Rapport d''état</p><p><b>message</b> <u>La commune demandée n'existe pas ou n'est pas accessible.</u></p>"+193 "<p><b>description</b> <u>La requête envoyée par le client était syntaxiquement incorrecte.</u></p>"+194 "<HR size=\"1\" noshade=\"noshade\"><h3>Apache Tomcat/DGFiP</h3></body></html>");195 assertTrue(m.matches());196 assertEquals("La commune demandée n'existe pas ou n'est pas accessible.", m.group(1));197 }198 173 }
Note:
See TracChangeset
for help on using the changeset viewer.