source: josm/trunk/test/unit/org/openstreetmap/josm/data/osm/UserTest.java @ 12750

Last change on this file since 12750 was 12750, checked in by Don-vip, 15 months ago

see #15229 - see #15182 - fix unit tests

  • Property svn:eol-style set to native
File size: 1.2 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.osm;
3
4import static org.junit.Assert.assertEquals;
5import static org.junit.Assert.assertSame;
6import static org.junit.Assert.assertTrue;
7
8import org.junit.Rule;
9import org.junit.Test;
10import org.openstreetmap.josm.testutils.JOSMTestRules;
11
12import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
13
14/**
15 * Tests of {@link User}.
16 */
17public class UserTest {
18
19    /**
20     * Setup test
21     */
22    @Rule
23    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
24    public JOSMTestRules test = new JOSMTestRules();
25
26    /**
27     * Test method for {@link User#createOsmUser}.
28     */
29    @Test
30    public void testCreateOsmUser() {
31        User user1 = User.createOsmUser(1, "name1");
32        assertEquals(1, user1.getId());
33        assertEquals("name1", user1.getName());
34        User user2 = User.createOsmUser(1, "name2");
35        assertSame(user1, user2);
36        assertEquals(1, user2.getId());
37        assertEquals("name2", user2.getName());
38        assertEquals(2, user2.getNames().size());
39        assertTrue(user2.getNames().contains("name1"));
40        assertTrue(user2.getNames().contains("name2"));
41    }
42}
Note: See TracBrowser for help on using the repository browser.