source: josm/trunk/test/unit/org/openstreetmap/josm/io/protocols/data/HandlerTest.java@ 17275

Last change on this file since 17275 was 17275, checked in by Don-vip, 5 years ago

see #16567 - upgrade almost all tests to JUnit 5, except those depending on WiremockRule

See https://github.com/tomakehurst/wiremock/issues/684

  • Property svn:eol-style set to native
File size: 1.3 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.io.protocols.data;
3
4import static org.junit.jupiter.api.Assertions.assertNotNull;
5
6import java.io.IOException;
7import java.net.URL;
8import java.net.URLConnection;
9
10import org.junit.jupiter.api.BeforeEach;
11import org.junit.jupiter.api.Test;
12import org.junit.jupiter.api.extension.RegisterExtension;
13import org.openstreetmap.josm.testutils.JOSMTestRules;
14
15/**
16 * Unit tests of {@link Handler} class.
17 */
18class HandlerTest {
19
20 /**
21 * Use the test rules to remove any layers and reset state.
22 */
23 @RegisterExtension
24 public final JOSMTestRules rules = new JOSMTestRules();
25
26 /**
27 * Setup test.
28 */
29 @BeforeEach
30 public void setUp() {
31 Handler.install();
32 }
33
34 /**
35 * Reads a base-64 image.
36 * @throws IOException if any I/O error occurs
37 */
38 @Test
39 void testBase64Image() throws IOException {
40 // Red dot image, taken from https://en.wikipedia.org/wiki/Data_URI_scheme#HTML
41 URLConnection connection = new Handler().openConnection(new URL("data:image/png;base64," +
42 "iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4"+
43 "//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="));
44 connection.connect();
45 assertNotNull(connection.getInputStream());
46 }
47}
Note: See TracBrowser for help on using the repository browser.