1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.gui.history;
|
---|
3 |
|
---|
4 | import static org.junit.Assert.assertEquals;
|
---|
5 |
|
---|
6 | import java.util.Date;
|
---|
7 |
|
---|
8 | import org.junit.Test;
|
---|
9 | import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
|
---|
10 | import org.openstreetmap.josm.data.osm.User;
|
---|
11 | import org.openstreetmap.josm.data.osm.history.HistoryDataSet;
|
---|
12 | import org.openstreetmap.josm.data.osm.history.HistoryNode;
|
---|
13 | import org.openstreetmap.josm.data.osm.history.HistoryRelation;
|
---|
14 | import org.openstreetmap.josm.data.osm.history.HistoryWay;
|
---|
15 | import org.openstreetmap.josm.tools.date.DateUtils;
|
---|
16 |
|
---|
17 | /**
|
---|
18 | * Unit tests of {@link HistoryBrowserDialog} class.
|
---|
19 | */
|
---|
20 | public class HistoryBrowserDialogTest {
|
---|
21 |
|
---|
22 | /**
|
---|
23 | * Test for {@link HistoryBrowserDialog#buildTitle}.
|
---|
24 | */
|
---|
25 | @Test
|
---|
26 | public void testBuildTitle() {
|
---|
27 | HistoryDataSet hds = new HistoryDataSet();
|
---|
28 | User user = User.createOsmUser(1, "");
|
---|
29 | Date date = DateUtils.fromString("2016-01-01");
|
---|
30 | hds.put(new HistoryNode(1, 1, true, user, 1, date, null));
|
---|
31 | assertEquals("History for node 1", HistoryBrowserDialog.buildTitle(hds.getHistory(1, OsmPrimitiveType.NODE)));
|
---|
32 | hds.put(new HistoryWay(1, 1, true, user, 1, date));
|
---|
33 | assertEquals("History for way 1", HistoryBrowserDialog.buildTitle(hds.getHistory(1, OsmPrimitiveType.WAY)));
|
---|
34 | hds.put(new HistoryRelation(1, 1, true, user, 1, date));
|
---|
35 | assertEquals("History for relation 1", HistoryBrowserDialog.buildTitle(hds.getHistory(1, OsmPrimitiveType.RELATION)));
|
---|
36 | }
|
---|
37 | }
|
---|