source: josm/trunk/test/unit/org/openstreetmap/josm/data/imagery/ShapeTest.java@ 17275

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

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

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

File size: 967 bytes
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.imagery;
3
4import static org.junit.jupiter.api.Assertions.assertEquals;
5
6import java.util.Arrays;
7
8import org.junit.jupiter.api.Test;
9
10/**
11 * Unit tests for class {@link Shape}.
12 */
13class ShapeTest {
14
15 /**
16 * Tests string conversion
17 */
18 @Test
19 void test() {
20 Shape shape = new Shape();
21 shape.addPoint("47.1", "11.1");
22 shape.addPoint("47.2", "11.2");
23 shape.addPoint("47.3", "11.3");
24 String shapeString = "47.1 11.1 47.2 11.2 47.3 11.3";
25 Shape fromString = new Shape(shapeString, " ");
26 assertEquals(shape, fromString);
27 assertEquals(shapeString, shape.encodeAsString(" "));
28 assertEquals("47.1//11.1//47.2//11.2//47.3//11.3", shape.encodeAsString("//"));
29 assertEquals("47.1,11.1,47.2,11.2,47.3,11.3;47.1,11.1,47.2,11.2,47.3,11.3", Shape.encodeAsString(Arrays.asList(shape, shape)));
30 }
31}
Note: See TracBrowser for help on using the repository browser.