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

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

fix unit test conflict

  • Property svn:eol-style set to native
File size: 1.3 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 try {
32 User user1 = User.createOsmUser(1, "name1");
33 assertEquals(1, user1.getId());
34 assertEquals("name1", user1.getName());
35 User user2 = User.createOsmUser(1, "name2");
36 assertSame(user1, user2);
37 assertEquals(1, user2.getId());
38 assertEquals("name2", user2.getName());
39 assertEquals(2, user2.getNames().size());
40 assertTrue(user2.getNames().contains("name1"));
41 assertTrue(user2.getNames().contains("name2"));
42 } finally {
43 User.clearUserMap();
44 }
45 }
46}
Note: See TracBrowser for help on using the repository browser.