Changeset 9967 in josm


Ignore:
Timestamp:
2016-03-12T11:35:43+01:00 (4 years ago)
Author:
Don-vip
Message:

cleanup unit tests

Location:
trunk/test/unit/org/openstreetmap/josm/data/validation/routines
Files:
3 edited

Legend:

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

    r9853 r9967  
    2525import java.lang.reflect.Field;
    2626import java.lang.reflect.Modifier;
    27 import java.net.IDN;
    2827import java.util.Locale;
    2928
     
    282281            assertEquals(s[1], DomainValidator.unicodeToASCII(s[0]));
    283282        }
    284     }
    285 
    286     /**
    287      * Check if IDN.toASCII is broken or not
    288      */
    289     @Test
    290     public void testIsIDNtoASCIIBroken() {
    291         System.out.println(">>DomainValidatorTest.testIsIDNtoASCIIBroken()");
    292         final String input = ".";
    293         final boolean ok = input.equals(IDN.toASCII(input));
    294         System.out.println("IDN.toASCII is " + (ok ? "OK" : "BROKEN"));
    295         String[] props = {
    296         "java.version", //    Java Runtime Environment version
    297         "java.vendor", // Java Runtime Environment vendor
    298         "java.vm.specification.version", //   Java Virtual Machine specification version
    299         "java.vm.specification.vendor", //    Java Virtual Machine specification vendor
    300         "java.vm.specification.name", //  Java Virtual Machine specification name
    301         "java.vm.version", // Java Virtual Machine implementation version
    302         "java.vm.vendor", //  Java Virtual Machine implementation vendor
    303         "java.vm.name", //    Java Virtual Machine implementation name
    304         "java.specification.version", //  Java Runtime Environment specification version
    305         "java.specification.vendor", //   Java Runtime Environment specification vendor
    306         "java.specification.name", // Java Runtime Environment specification name
    307         "java.class.version", //  Java class format version number
    308         };
    309         for (String t : props) {
    310             System.out.println(t + "=" + System.getProperty(t));
    311         }
    312         System.out.println("<<DomainValidatorTest.testIsIDNtoASCIIBroken()");
    313283    }
    314284
  • trunk/test/unit/org/openstreetmap/josm/data/validation/routines/RegexValidatorTest.java

    r9853 r9967  
    1818
    1919import static org.junit.Assert.assertEquals;
     20import static org.junit.Assert.assertFalse;
    2021import static org.junit.Assert.assertNull;
     22import static org.junit.Assert.assertTrue;
    2123import static org.junit.Assert.fail;
    2224
     
    5658
    5759        // isValid()
    58         assertEquals("Sensitive isValid() valid",     true,   sensitive.isValid("ac-DE-1"));
    59         assertEquals("Sensitive isValid() invalid",   false,  sensitive.isValid("AB-de-1"));
    60         assertEquals("Insensitive isValid() valid",   true,   insensitive.isValid("AB-de-1"));
    61         assertEquals("Insensitive isValid() invalid", false, insensitive.isValid("ABd-de-1"));
     60        assertTrue("Sensitive isValid() valid",      sensitive.isValid("ac-DE-1"));
     61        assertFalse("Sensitive isValid() invalid",   sensitive.isValid("AB-de-1"));
     62        assertTrue("Insensitive isValid() valid",    insensitive.isValid("AB-de-1"));
     63        assertFalse("Insensitive isValid() invalid", insensitive.isValid("ABd-de-1"));
    6264
    6365        // validate()
    64         assertEquals("Sensitive validate() valid",     "acDE1", sensitive.validate("ac-DE-1"));
    65         assertEquals("Sensitive validate() invalid",   null,    sensitive.validate("AB-de-1"));
    66         assertEquals("Insensitive validate() valid",   "ABde1", insensitive.validate("AB-de-1"));
    67         assertEquals("Insensitive validate() invalid", null,    insensitive.validate("ABd-de-1"));
     66        assertEquals("Sensitive validate() valid",   "acDE1", sensitive.validate("ac-DE-1"));
     67        assertNull("Sensitive validate() invalid",   sensitive.validate("AB-de-1"));
     68        assertEquals("Insensitive validate() valid", "ABde1", insensitive.validate("AB-de-1"));
     69        assertNull("Insensitive validate() invalid", insensitive.validate("ABd-de-1"));
    6870
    6971        // match()
     
    9496
    9597        // isValid()
    96         assertEquals("Sensitive isValid() Multiple", true, multiple.isValid(value));
    97         assertEquals("Sensitive isValid() 1st",      false, single1.isValid(value));
    98         assertEquals("Sensitive isValid() 2nd",      true,  single2.isValid(value));
    99         assertEquals("Sensitive isValid() 3rd",      false, single3.isValid(value));
     98        assertTrue("Sensitive isValid() Multiple", multiple.isValid(value));
     99        assertFalse("Sensitive isValid() 1st",    single1.isValid(value));
     100        assertTrue("Sensitive isValid() 2nd",      single2.isValid(value));
     101        assertFalse("Sensitive isValid() 3rd",    single3.isValid(value));
    100102
    101103        // validate()
    102104        assertEquals("Sensitive validate() Multiple", expect, multiple.validate(value));
    103         assertNull("Sensitive validate() 1st",      single1.validate(value));
     105        assertNull("Sensitive validate() 1st",        single1.validate(value));
    104106        assertEquals("Sensitive validate() 2nd",      expect, single2.validate(value));
    105         assertNull("Sensitive validate() 3rd",      single3.validate(value));
     107        assertNull("Sensitive validate() 3rd",        single3.validate(value));
    106108
    107109        // match()
     
    113115        // All invalid
    114116        value = "AAC*FDE*321";
    115         assertEquals("isValid() Invalid",  false, multiple.isValid(value));
     117        assertFalse("isValid() Invalid", multiple.isValid(value));
    116118        assertNull("validate() Invalid", multiple.validate(value));
    117119        assertNull("match() Multiple",   multiple.match(value));
     
    136138
    137139        // isValid()
    138         assertEquals("isValid() Multiple", true, multiple.isValid(value));
    139         assertEquals("isValid() 1st",      false, single1.isValid(value));
    140         assertEquals("isValid() 2nd",      true,  single2.isValid(value));
    141         assertEquals("isValid() 3rd",      false, single3.isValid(value));
     140        assertTrue("isValid() Multiple", multiple.isValid(value));
     141        assertFalse("isValid() 1st",    single1.isValid(value));
     142        assertTrue("isValid() 2nd",      single2.isValid(value));
     143        assertFalse("isValid() 3rd",    single3.isValid(value));
    142144
    143145        // validate()
    144146        assertEquals("validate() Multiple", expect, multiple.validate(value));
    145         assertNull("validate() 1st",      single1.validate(value));
     147        assertNull("validate() 1st",        single1.validate(value));
    146148        assertEquals("validate() 2nd",      expect, single2.validate(value));
    147         assertNull("validate() 3rd",      single3.validate(value));
     149        assertNull("validate() 3rd",        single3.validate(value));
    148150
    149151        // match()
     
    155157        // All invalid
    156158        value = "AAC*FDE*321";
    157         assertEquals("isValid() Invalid",  false, multiple.isValid(value));
     159        assertFalse("isValid() Invalid", multiple.isValid(value));
    158160        assertNull("validate() Invalid", multiple.validate(value));
    159161        assertNull("match() Multiple",   multiple.match(value));
     
    165167    @Test
    166168    public void testNullValue() {
    167 
    168169        RegexValidator validator = new RegexValidator(REGEX);
    169         assertEquals("Instance isValid()",  false, validator.isValid(null));
     170        assertFalse("Instance isValid()", validator.isValid(null));
    170171        assertNull("Instance validate()", validator.validate(null));
    171172        assertNull("Instance match()",    validator.match(null));
  • trunk/test/unit/org/openstreetmap/josm/data/validation/routines/UrlValidatorTest.java

    r9853 r9967  
    399399       }
    400400       return carryMsg.toString();
    401    }
    402 
    403    /**
    404     * Test validate URL
    405     */
    406    @Test
    407    public void testValidateUrl() {
    408       assertTrue(true);
    409401   }
    410402
Note: See TracChangeset for help on using the changeset viewer.