Changeset 15603 in josm for trunk/test


Ignore:
Timestamp:
2019-12-21T03:15:48+01:00 (4 years ago)
Author:
Don-vip
Message:

fix #18441 - Allow plugins to remove a test they added (patch by taylor.smock)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/data/validation/OsmValidatorTest.java

    r15460 r15603  
    33
    44import static org.junit.Assert.assertFalse;
     5import static org.junit.Assert.assertNotEquals;
    56import static org.junit.Assert.assertTrue;
    67
     
    89import org.junit.Rule;
    910import org.junit.Test;
     11import org.openstreetmap.josm.data.validation.tests.Addresses;
    1012import org.openstreetmap.josm.testutils.JOSMTestRules;
    1113
     
    8486    }
    8587
     88    /**
     89     * Test that tests are really removed, and that core tests cannot be removed
     90     */
     91    @Test
     92    public void testRemoveTests() {
     93        org.openstreetmap.josm.data.validation.Test test = new org.openstreetmap.josm.data.validation.Test("test") {
     94        };
     95        assertNotEquals(org.openstreetmap.josm.data.validation.Test.class, test.getClass());
     96        OsmValidator.addTest(test.getClass());
     97        assertTrue(OsmValidator.getAllAvailableTestClasses().contains(test.getClass()));
     98        assertTrue(OsmValidator.removeTest(test.getClass()));
     99        assertFalse(OsmValidator.removeTest(test.getClass()));
     100        assertFalse(OsmValidator.getAllAvailableTestClasses().contains(test.getClass()));
     101
     102        assertTrue(OsmValidator.getAllAvailableTestClasses().contains(Addresses.class));
     103        assertFalse(OsmValidator.removeTest(Addresses.class));
     104        assertTrue(OsmValidator.getAllAvailableTestClasses().contains(Addresses.class));
     105    }
     106
    86107}
Note: See TracChangeset for help on using the changeset viewer.