1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.actions;
|
---|
3 |
|
---|
4 | import static org.junit.Assert.assertEquals;
|
---|
5 |
|
---|
6 | import java.util.Arrays;
|
---|
7 | import java.util.Collections;
|
---|
8 |
|
---|
9 | import org.junit.BeforeClass;
|
---|
10 | import org.junit.Test;
|
---|
11 | import org.openstreetmap.josm.JOSMFixture;
|
---|
12 | import org.openstreetmap.josm.data.osm.Relation;
|
---|
13 | import org.openstreetmap.josm.data.osm.Way;
|
---|
14 |
|
---|
15 | /**
|
---|
16 | * Unit tests for class {@link CopyAction}.
|
---|
17 | */
|
---|
18 | public class CopyActionTest {
|
---|
19 |
|
---|
20 | /**
|
---|
21 | * Setup test.
|
---|
22 | */
|
---|
23 | @BeforeClass
|
---|
24 | public static void setUpBeforeClass() {
|
---|
25 | JOSMFixture.createUnitTestFixture().init();
|
---|
26 | }
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * Test of {@link CopyAction#getCopyString} method for a single way.
|
---|
30 | */
|
---|
31 | @Test
|
---|
32 | public void testCopyStringWay() {
|
---|
33 | final Way way = new Way(123L);
|
---|
34 | assertEquals("way 123", CopyAction.getCopyString(Collections.singleton(way)));
|
---|
35 | }
|
---|
36 |
|
---|
37 | /**
|
---|
38 | * Test of {@link CopyAction#getCopyString} method for a way and a relation.
|
---|
39 | */
|
---|
40 | @Test
|
---|
41 | public void testCopyStringWayRelation() {
|
---|
42 | final Way way = new Way(123L);
|
---|
43 | final Relation relation = new Relation(456);
|
---|
44 | assertEquals("way 123,relation 456", CopyAction.getCopyString(Arrays.asList(way, relation)));
|
---|
45 | assertEquals("relation 456,way 123", CopyAction.getCopyString(Arrays.asList(relation, way)));
|
---|
46 | }
|
---|
47 | }
|
---|