Changeset 15058 in josm
- Timestamp:
- 2019-05-06T23:42:21+02:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/io/CertificateAmendmentTestIT.java
r14498 r15058 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.io; 3 4 import static org.junit.Assume.assumeFalse; 3 5 4 6 import java.io.IOException; 5 7 import java.net.URL; 6 8 import java.net.URLConnection; 9 import java.util.ArrayList; 10 import java.util.List; 7 11 8 12 import javax.net.ssl.SSLHandshakeException; 9 13 10 14 import org.junit.Assert; 11 import org.junit.Rule; 15 import org.junit.BeforeClass; 16 import org.junit.ClassRule; 12 17 import org.junit.Test; 18 import org.openstreetmap.josm.TestUtils; 13 19 import org.openstreetmap.josm.testutils.JOSMTestRules; 14 20 … … 23 29 * Setup rule 24 30 */ 25 @ Rule31 @ClassRule 26 32 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 27 public JOSMTestRules test = new JOSMTestRules().https().timeout(20000); 33 public static JOSMTestRules test = new JOSMTestRules().https().preferences().timeout(20000); 34 35 private static final List<String> errorsToIgnore = new ArrayList<>(); 36 37 /** 38 * Setup test 39 * @throws IOException in case of I/O error 40 */ 41 @BeforeClass 42 public static void beforeClass() throws IOException { 43 errorsToIgnore.addAll(TestUtils.getIgnoredErrorMessages(CertificateAmendmentTestIT.class)); 44 } 28 45 29 46 /** … … 95 112 connection.connect(); 96 113 } catch (SSLHandshakeException e) { 114 String error = "Untrusted: " + url; 115 assumeFalse(errorsToIgnore.contains(error)); 97 116 if (shouldWork) { 98 throw new IOException( "Untrusted: " + url, e);117 throw new IOException(error, e); 99 118 } else { 100 119 return; 101 120 } 102 121 } 122 String error = "Expected error: " + url; 123 assumeFalse(errorsToIgnore.contains(error)); 103 124 if (!shouldWork) { 104 Assert.fail( "Expected error: " + url);125 Assert.fail(error); 105 126 } 106 127 }
Note:
See TracChangeset
for help on using the changeset viewer.