Changeset 12743 in josm for trunk/test/unit/org
- Timestamp:
- 2017-09-05T21:13:21+02:00 (7 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm
- Files:
-
- 2 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/UserIdentityManagerTest.java
r12742 r12743 1 1 // License: GPL. For details, see LICENSE file. 2 package org.openstreetmap.josm. gui;2 package org.openstreetmap.josm.data; 3 3 4 4 import static org.junit.Assert.assertEquals; … … 17 17 18 18 /** 19 * Unit tests of {@link JosmUserIdentityManager} class.19 * Unit tests of {@link UserIdentityManager} class. 20 20 */ 21 public class JosmUserIdentityManagerTest {21 public class UserIdentityManagerTest { 22 22 23 23 /** … … 46 46 public void testSingletonAccess() { 47 47 48 JosmUserIdentityManager im = JosmUserIdentityManager.getInstance();48 UserIdentityManager im = UserIdentityManager.getInstance(); 49 49 50 50 // created ? 51 51 assertNotNull(im); 52 52 53 JosmUserIdentityManager im2 = JosmUserIdentityManager.getInstance();53 UserIdentityManager im2 = UserIdentityManager.getInstance(); 54 54 55 55 // only one instance … … 58 58 59 59 /** 60 * Unit test of {@link JosmUserIdentityManager#setAnonymous}.60 * Unit test of {@link UserIdentityManager#setAnonymous}. 61 61 */ 62 62 @Test 63 63 public void testSetAnonymous() { 64 JosmUserIdentityManager im = JosmUserIdentityManager.getInstance();64 UserIdentityManager im = UserIdentityManager.getInstance(); 65 65 66 66 im.setPartiallyIdentified("test"); … … 78 78 79 79 /** 80 * Unit test of {@link JosmUserIdentityManager#setPartiallyIdentified} - nominal case.80 * Unit test of {@link UserIdentityManager#setPartiallyIdentified} - nominal case. 81 81 */ 82 82 @Test 83 83 public void testSetPartiallyIdentified() { 84 JosmUserIdentityManager im = JosmUserIdentityManager.getInstance();84 UserIdentityManager im = UserIdentityManager.getInstance(); 85 85 im.setPartiallyIdentified("test"); 86 86 … … 98 98 99 99 /** 100 * Unit test of {@link JosmUserIdentityManager#setPartiallyIdentified} - null case.100 * Unit test of {@link UserIdentityManager#setPartiallyIdentified} - null case. 101 101 */ 102 102 @Test(expected = IllegalArgumentException.class) 103 103 public void testSetPartiallyIdentifiedNull() { 104 JosmUserIdentityManager.getInstance().setPartiallyIdentified(null);105 } 106 107 /** 108 * Unit test of {@link JosmUserIdentityManager#setPartiallyIdentified} - empty case.104 UserIdentityManager.getInstance().setPartiallyIdentified(null); 105 } 106 107 /** 108 * Unit test of {@link UserIdentityManager#setPartiallyIdentified} - empty case. 109 109 */ 110 110 @Test(expected = IllegalArgumentException.class) 111 111 public void testSetPartiallyIdentifiedEmpty() { 112 JosmUserIdentityManager.getInstance().setPartiallyIdentified("");113 } 114 115 /** 116 * Unit test of {@link JosmUserIdentityManager#setPartiallyIdentified} - blank case.112 UserIdentityManager.getInstance().setPartiallyIdentified(""); 113 } 114 115 /** 116 * Unit test of {@link UserIdentityManager#setPartiallyIdentified} - blank case. 117 117 */ 118 118 @Test(expected = IllegalArgumentException.class) 119 119 public void testSetPartiallyIdentifiedBlank() { 120 JosmUserIdentityManager.getInstance().setPartiallyIdentified(" \t ");121 } 122 123 /** 124 * Unit test of {@link JosmUserIdentityManager#setFullyIdentified} - nominal case.120 UserIdentityManager.getInstance().setPartiallyIdentified(" \t "); 121 } 122 123 /** 124 * Unit test of {@link UserIdentityManager#setFullyIdentified} - nominal case. 125 125 */ 126 126 @Test 127 127 public void testSetFullyIdentified() { 128 JosmUserIdentityManager im = JosmUserIdentityManager.getInstance();128 UserIdentityManager im = UserIdentityManager.getInstance(); 129 129 130 130 UserInfo userInfo = newUserInfo(); … … 145 145 146 146 /** 147 * Unit test of {@link JosmUserIdentityManager#setFullyIdentified} - null name case.147 * Unit test of {@link UserIdentityManager#setFullyIdentified} - null name case. 148 148 */ 149 149 @Test(expected = IllegalArgumentException.class) 150 150 public void testSetFullyIdentifiedNullName() { 151 JosmUserIdentityManager.getInstance().setFullyIdentified(null, newUserInfo());152 } 153 154 /** 155 * Unit test of {@link JosmUserIdentityManager#setFullyIdentified} - empty name case.151 UserIdentityManager.getInstance().setFullyIdentified(null, newUserInfo()); 152 } 153 154 /** 155 * Unit test of {@link UserIdentityManager#setFullyIdentified} - empty name case. 156 156 */ 157 157 @Test(expected = IllegalArgumentException.class) 158 158 public void testSetFullyIdentifiedEmptyName() { 159 JosmUserIdentityManager.getInstance().setFullyIdentified("", newUserInfo());160 } 161 162 /** 163 * Unit test of {@link JosmUserIdentityManager#setFullyIdentified} - blank name case.159 UserIdentityManager.getInstance().setFullyIdentified("", newUserInfo()); 160 } 161 162 /** 163 * Unit test of {@link UserIdentityManager#setFullyIdentified} - blank name case. 164 164 */ 165 165 @Test(expected = IllegalArgumentException.class) 166 166 public void testSetFullyIdentifiedBlankName() { 167 JosmUserIdentityManager.getInstance().setFullyIdentified(" \t ", newUserInfo());168 } 169 170 /** 171 * Unit test of {@link JosmUserIdentityManager#setFullyIdentified} - null info case.167 UserIdentityManager.getInstance().setFullyIdentified(" \t ", newUserInfo()); 168 } 169 170 /** 171 * Unit test of {@link UserIdentityManager#setFullyIdentified} - null info case. 172 172 */ 173 173 @Test(expected = IllegalArgumentException.class) 174 174 public void testSetFullyIdentifiedNullInfo() { 175 JosmUserIdentityManager.getInstance().setFullyIdentified("test", null);175 UserIdentityManager.getInstance().setFullyIdentified("test", null); 176 176 } 177 177 … … 181 181 @Test 182 182 public void testInitFromPreferences1() { 183 JosmUserIdentityManager im = JosmUserIdentityManager.getInstance();183 UserIdentityManager im = UserIdentityManager.getInstance(); 184 184 185 185 // reset it … … 206 206 @Test 207 207 public void testInitFromPreferences2() { 208 JosmUserIdentityManager im = JosmUserIdentityManager.getInstance();208 UserIdentityManager im = UserIdentityManager.getInstance(); 209 209 210 210 // reset it … … 231 231 @Test 232 232 public void testInitFromPreferences3() { 233 JosmUserIdentityManager im = JosmUserIdentityManager.getInstance();233 UserIdentityManager im = UserIdentityManager.getInstance(); 234 234 235 235 // for this test we disable the listener … … 258 258 @Test 259 259 public void testInitFromPreferences4() { 260 JosmUserIdentityManager im = JosmUserIdentityManager.getInstance();260 UserIdentityManager im = UserIdentityManager.getInstance(); 261 261 262 262 // for this test we disable the listener … … 284 284 @Test 285 285 public void testInitFromPreferences5() { 286 JosmUserIdentityManager im = JosmUserIdentityManager.getInstance();286 UserIdentityManager im = UserIdentityManager.getInstance(); 287 287 288 288 // for this test we disable the listener … … 305 305 @Test 306 306 public void testApiUrlChanged() { 307 JosmUserIdentityManager im = JosmUserIdentityManager.getInstance();307 UserIdentityManager im = UserIdentityManager.getInstance(); 308 308 309 309 // reset it … … 341 341 342 342 @Test 343 //@Ignore344 343 public void testUserNameChanged() { 345 JosmUserIdentityManager im = JosmUserIdentityManager.getInstance();344 UserIdentityManager im = UserIdentityManager.getInstance(); 346 345 347 346 // reset it -
trunk/test/unit/org/openstreetmap/josm/data/osm/ChangesetCacheTest.java
r12034 r12743 15 15 import org.junit.Test; 16 16 import org.openstreetmap.josm.TestUtils; 17 import org.openstreetmap.josm. gui.JosmUserIdentityManager;17 import org.openstreetmap.josm.data.UserIdentityManager; 18 18 19 19 /** … … 259 259 assertEquals(3, cache.getChangesets().size()); 260 260 261 JosmUserIdentityManager.getInstance().setAnonymous();261 UserIdentityManager.getInstance().setAnonymous(); 262 262 assertEquals(2, cache.getOpenChangesetsForCurrentUser().size()); 263 263 264 JosmUserIdentityManager.getInstance().setPartiallyIdentified("foo");264 UserIdentityManager.getInstance().setPartiallyIdentified("foo"); 265 265 assertEquals(1, cache.getOpenChangesetsForCurrentUser().size()); 266 266 } -
trunk/test/unit/org/openstreetmap/josm/gui/io/DownloadOpenChangesetsTaskTest.java
r11110 r12743 10 10 import org.junit.Rule; 11 11 import org.junit.Test; 12 import org.openstreetmap.josm. gui.JosmUserIdentityManager;12 import org.openstreetmap.josm.data.UserIdentityManager; 13 13 import org.openstreetmap.josm.testutils.JOSMTestRules; 14 14 … … 35 35 assertNull(task.getChangesets()); 36 36 37 assertTrue( JosmUserIdentityManager.getInstance().isAnonymous());37 assertTrue(UserIdentityManager.getInstance().isAnonymous()); 38 38 task.run(); 39 39 assertNull(task.getChangesets()); 40 40 41 41 task = new DownloadOpenChangesetsTask(new JPanel()); 42 JosmUserIdentityManager.getInstance().setPartiallyIdentified(System.getProperty("osm.username", "josm_test"));43 assertTrue( JosmUserIdentityManager.getInstance().isPartiallyIdentified());42 UserIdentityManager.getInstance().setPartiallyIdentified(System.getProperty("osm.username", "josm_test")); 43 assertTrue(UserIdentityManager.getInstance().isPartiallyIdentified()); 44 44 task.run(); 45 45 assertNotNull(task.getChangesets());
Note:
See TracChangeset
for help on using the changeset viewer.