1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.data.osm.history;
|
---|
3 |
|
---|
4 | import static org.junit.Assert.assertEquals;
|
---|
5 | import static org.junit.Assert.assertTrue;
|
---|
6 |
|
---|
7 | import java.util.Date;
|
---|
8 |
|
---|
9 | import org.junit.Test;
|
---|
10 | import org.openstreetmap.josm.data.coor.LatLon;
|
---|
11 | import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
|
---|
12 | import org.openstreetmap.josm.data.osm.User;
|
---|
13 |
|
---|
14 | /**
|
---|
15 | * Unit tests for class {@link HistoryNode}.
|
---|
16 | */
|
---|
17 | public class HistoryNodeTest {
|
---|
18 |
|
---|
19 | @Test
|
---|
20 | public void historyNode() {
|
---|
21 | Date d = new Date();
|
---|
22 | HistoryNode node = new HistoryNode(
|
---|
23 | 1L,
|
---|
24 | 2L,
|
---|
25 | true,
|
---|
26 | User.createOsmUser(3, "testuser"),
|
---|
27 | 4L,
|
---|
28 | d,
|
---|
29 | new LatLon(0, 0)
|
---|
30 | );
|
---|
31 |
|
---|
32 | assertEquals(1, node.getId());
|
---|
33 | assertEquals(2, node.getVersion());
|
---|
34 | assertTrue(node.isVisible());
|
---|
35 | assertEquals("testuser", node.getUser().getName());
|
---|
36 | assertEquals(3, node.getUser().getId());
|
---|
37 | assertEquals(4, node.getChangesetId());
|
---|
38 | assertEquals(d, node.getTimestamp());
|
---|
39 | }
|
---|
40 |
|
---|
41 | @Test
|
---|
42 | public void getType() {
|
---|
43 | Date d = new Date();
|
---|
44 | HistoryNode node = new HistoryNode(
|
---|
45 | 1,
|
---|
46 | 2,
|
---|
47 | true,
|
---|
48 | User.createOsmUser(3, "testuser"),
|
---|
49 | 4,
|
---|
50 | d,
|
---|
51 | new LatLon(0, 0)
|
---|
52 | );
|
---|
53 |
|
---|
54 | assertEquals(OsmPrimitiveType.NODE, node.getType());
|
---|
55 | }
|
---|
56 | }
|
---|