Changeset 12743 in josm for trunk/test/unit/org


Ignore:
Timestamp:
2017-09-05T21:13:21+02:00 (7 years ago)
Author:
Don-vip
Message:

see #15229 - see #15182 - deprecate gui.JosmUserIdentityManager - replaced by data.UserIdentityManager

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  
    11// License: GPL. For details, see LICENSE file.
    2 package org.openstreetmap.josm.gui;
     2package org.openstreetmap.josm.data;
    33
    44import static org.junit.Assert.assertEquals;
     
    1717
    1818/**
    19  * Unit tests of {@link JosmUserIdentityManager} class.
     19 * Unit tests of {@link UserIdentityManager} class.
    2020 */
    21 public class JosmUserIdentityManagerTest {
     21public class UserIdentityManagerTest {
    2222
    2323    /**
     
    4646    public void testSingletonAccess() {
    4747
    48         JosmUserIdentityManager im = JosmUserIdentityManager.getInstance();
     48        UserIdentityManager im = UserIdentityManager.getInstance();
    4949
    5050        // created ?
    5151        assertNotNull(im);
    5252
    53         JosmUserIdentityManager im2 = JosmUserIdentityManager.getInstance();
     53        UserIdentityManager im2 = UserIdentityManager.getInstance();
    5454
    5555        // only one instance
     
    5858
    5959    /**
    60      * Unit test of {@link JosmUserIdentityManager#setAnonymous}.
     60     * Unit test of {@link UserIdentityManager#setAnonymous}.
    6161     */
    6262    @Test
    6363    public void testSetAnonymous() {
    64         JosmUserIdentityManager im = JosmUserIdentityManager.getInstance();
     64        UserIdentityManager im = UserIdentityManager.getInstance();
    6565
    6666        im.setPartiallyIdentified("test");
     
    7878
    7979    /**
    80      * Unit test of {@link JosmUserIdentityManager#setPartiallyIdentified} - nominal case.
     80     * Unit test of {@link UserIdentityManager#setPartiallyIdentified} - nominal case.
    8181     */
    8282    @Test
    8383    public void testSetPartiallyIdentified() {
    84         JosmUserIdentityManager im = JosmUserIdentityManager.getInstance();
     84        UserIdentityManager im = UserIdentityManager.getInstance();
    8585        im.setPartiallyIdentified("test");
    8686
     
    9898
    9999    /**
    100      * Unit test of {@link JosmUserIdentityManager#setPartiallyIdentified} - null case.
     100     * Unit test of {@link UserIdentityManager#setPartiallyIdentified} - null case.
    101101     */
    102102    @Test(expected = IllegalArgumentException.class)
    103103    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.
    109109     */
    110110    @Test(expected = IllegalArgumentException.class)
    111111    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.
    117117     */
    118118    @Test(expected = IllegalArgumentException.class)
    119119    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.
    125125     */
    126126    @Test
    127127    public void testSetFullyIdentified() {
    128         JosmUserIdentityManager im = JosmUserIdentityManager.getInstance();
     128        UserIdentityManager im = UserIdentityManager.getInstance();
    129129
    130130        UserInfo userInfo = newUserInfo();
     
    145145
    146146    /**
    147      * Unit test of {@link JosmUserIdentityManager#setFullyIdentified} - null name case.
     147     * Unit test of {@link UserIdentityManager#setFullyIdentified} - null name case.
    148148     */
    149149    @Test(expected = IllegalArgumentException.class)
    150150    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.
    156156     */
    157157    @Test(expected = IllegalArgumentException.class)
    158158    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.
    164164     */
    165165    @Test(expected = IllegalArgumentException.class)
    166166    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.
    172172     */
    173173    @Test(expected = IllegalArgumentException.class)
    174174    public void testSetFullyIdentifiedNullInfo() {
    175         JosmUserIdentityManager.getInstance().setFullyIdentified("test", null);
     175        UserIdentityManager.getInstance().setFullyIdentified("test", null);
    176176    }
    177177
     
    181181    @Test
    182182    public void testInitFromPreferences1() {
    183         JosmUserIdentityManager im = JosmUserIdentityManager.getInstance();
     183        UserIdentityManager im = UserIdentityManager.getInstance();
    184184
    185185        // reset it
     
    206206    @Test
    207207    public void testInitFromPreferences2() {
    208         JosmUserIdentityManager im = JosmUserIdentityManager.getInstance();
     208        UserIdentityManager im = UserIdentityManager.getInstance();
    209209
    210210        // reset it
     
    231231    @Test
    232232    public void testInitFromPreferences3() {
    233         JosmUserIdentityManager im = JosmUserIdentityManager.getInstance();
     233        UserIdentityManager im = UserIdentityManager.getInstance();
    234234
    235235        // for this test we disable the listener
     
    258258    @Test
    259259    public void testInitFromPreferences4() {
    260         JosmUserIdentityManager im = JosmUserIdentityManager.getInstance();
     260        UserIdentityManager im = UserIdentityManager.getInstance();
    261261
    262262        // for this test we disable the listener
     
    284284    @Test
    285285    public void testInitFromPreferences5() {
    286         JosmUserIdentityManager im = JosmUserIdentityManager.getInstance();
     286        UserIdentityManager im = UserIdentityManager.getInstance();
    287287
    288288        // for this test we disable the listener
     
    305305    @Test
    306306    public void testApiUrlChanged() {
    307         JosmUserIdentityManager im = JosmUserIdentityManager.getInstance();
     307        UserIdentityManager im = UserIdentityManager.getInstance();
    308308
    309309        // reset it
     
    341341
    342342    @Test
    343     //@Ignore
    344343    public void testUserNameChanged() {
    345         JosmUserIdentityManager im = JosmUserIdentityManager.getInstance();
     344        UserIdentityManager im = UserIdentityManager.getInstance();
    346345
    347346        // reset it
  • trunk/test/unit/org/openstreetmap/josm/data/osm/ChangesetCacheTest.java

    r12034 r12743  
    1515import org.junit.Test;
    1616import org.openstreetmap.josm.TestUtils;
    17 import org.openstreetmap.josm.gui.JosmUserIdentityManager;
     17import org.openstreetmap.josm.data.UserIdentityManager;
    1818
    1919/**
     
    259259        assertEquals(3, cache.getChangesets().size());
    260260
    261         JosmUserIdentityManager.getInstance().setAnonymous();
     261        UserIdentityManager.getInstance().setAnonymous();
    262262        assertEquals(2, cache.getOpenChangesetsForCurrentUser().size());
    263263
    264         JosmUserIdentityManager.getInstance().setPartiallyIdentified("foo");
     264        UserIdentityManager.getInstance().setPartiallyIdentified("foo");
    265265        assertEquals(1, cache.getOpenChangesetsForCurrentUser().size());
    266266    }
  • trunk/test/unit/org/openstreetmap/josm/gui/io/DownloadOpenChangesetsTaskTest.java

    r11110 r12743  
    1010import org.junit.Rule;
    1111import org.junit.Test;
    12 import org.openstreetmap.josm.gui.JosmUserIdentityManager;
     12import org.openstreetmap.josm.data.UserIdentityManager;
    1313import org.openstreetmap.josm.testutils.JOSMTestRules;
    1414
     
    3535        assertNull(task.getChangesets());
    3636
    37         assertTrue(JosmUserIdentityManager.getInstance().isAnonymous());
     37        assertTrue(UserIdentityManager.getInstance().isAnonymous());
    3838        task.run();
    3939        assertNull(task.getChangesets());
    4040
    4141        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());
    4444        task.run();
    4545        assertNotNull(task.getChangesets());
Note: See TracChangeset for help on using the changeset viewer.