Changeset 10378 in josm for trunk/test/unit/org/openstreetmap/josm/data/validation/routines
- Timestamp:
- 2016-06-15T10:30:37+02:00 (9 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm/data/validation/routines
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/validation/routines/EmailValidatorTest.java
r10338 r10378 58 58 */ 59 59 @Test 60 public void testEmail() 60 public void testEmail() { 61 61 assertTrue(validator.isValid("jsmith@apache.org")); 62 62 assertFalse(validator.isValid(null)); … … 67 67 */ 68 68 @Test 69 public void testEmailWithNumericAddress() 69 public void testEmailWithNumericAddress() { 70 70 assertTrue(validator.isValid("someone@[216.109.118.76]")); 71 71 assertTrue(validator.isValid("someone@yahoo.com")); … … 76 76 */ 77 77 @Test 78 public void testEmailExtension() 78 public void testEmailExtension() { 79 79 assertTrue(validator.isValid("jsmith@apache.org")); 80 80 … … 99 99 */ 100 100 @Test 101 public void testEmailWithDash() 101 public void testEmailWithDash() { 102 102 assertTrue(validator.isValid("andy.noble@data-workshop.com")); 103 103 … … 114 114 */ 115 115 @Test 116 public void testEmailWithDotEnd() 116 public void testEmailWithDotEnd() { 117 117 assertFalse(validator.isValid("andy.noble@data-workshop.com.")); 118 118 } … … 123 123 */ 124 124 @Test 125 public void testEmailWithBogusCharacter() 125 public void testEmailWithBogusCharacter() { 126 126 127 127 assertFalse(validator.isValid("andy.noble@\u008fdata-workshop.com")); … … 184 184 */ 185 185 @Test 186 public void testEmailWithCommas() 186 public void testEmailWithCommas() { 187 187 assertFalse(validator.isValid("joeblow@apa,che.org")); 188 188 … … 196 196 */ 197 197 @Test 198 public void testEmailWithSpaces() 198 public void testEmailWithSpaces() { 199 199 assertFalse(validator.isValid("joeblow @apache.org")); // TODO - this should be valid? 200 200 … … 215 215 */ 216 216 @Test 217 public void testEmailWithControlChars() 217 public void testEmailWithControlChars() { 218 218 for (char c = 0; c < 32; c++) { 219 219 assertFalse("Test control char " + ((int) c), validator.isValid("foo" + c + "bar@domain.com")); … … 278 278 */ 279 279 @Test 280 public void testEmailUserName() 280 public void testEmailUserName() { 281 281 282 282 assertTrue(validator.isValid("joe1blow@apache.org")); … … 492 492 @Ignore("This test fails so disable it for 1.1.4 release. The real solution is to fix the email parsing") 493 493 @Test 494 public void testEmailFromPerl() 494 public void testEmailFromPerl() { 495 495 for (int index = 0; index < testEmailFromPerl.length; index++) { 496 496 String item = testEmailFromPerl[index].item; -
trunk/test/unit/org/openstreetmap/josm/data/validation/routines/InetAddressValidatorTest.java
r10338 r10378 47 47 @Test 48 48 public void testInetAddressesFromTheWild() { 49 assertTrue("www.apache.org IP should be valid", validator.isValid("140.211.11.130")); 50 assertTrue("www.l.google.com IP should be valid", validator.isValid("72.14.253.103")); 51 assertTrue("fsf.org IP should be valid", validator.isValid("199.232.41.5")); 52 assertTrue("appscs.ign.com IP should be valid", validator.isValid("216.35.123.87")); 49 // CHECKSTYLE.OFF: SingleSpaceSeparator 50 assertTrue("www.apache.org IP should be valid", validator.isValid("140.211.11.130")); 51 assertTrue("www.l.google.com IP should be valid", validator.isValid("72.14.253.103")); 52 assertTrue("fsf.org IP should be valid", validator.isValid("199.232.41.5")); 53 assertTrue("appscs.ign.com IP should be valid", validator.isValid("216.35.123.87")); 54 // CHECKSTYLE.ON: SingleSpaceSeparator 53 55 } 54 56 … … 67 69 @Test 68 70 public void testInetAddressesByClass() { 69 assertTrue("class A IP should be valid", validator.isValid("24.25.231.12")); 70 assertFalse("illegal class A IP should be invalid", validator.isValid("2.41.32.324")); 71 72 assertTrue("class B IP should be valid", validator.isValid("135.14.44.12")); 73 assertFalse("illegal class B IP should be invalid", validator.isValid("154.123.441.123")); 74 75 assertTrue("class C IP should be valid", validator.isValid("213.25.224.32")); 76 assertFalse("illegal class C IP should be invalid", validator.isValid("201.543.23.11")); 77 78 assertTrue("class D IP should be valid", validator.isValid("229.35.159.6")); 79 assertFalse("illegal class D IP should be invalid", validator.isValid("231.54.11.987")); 80 81 assertTrue("class E IP should be valid", validator.isValid("248.85.24.92")); 82 assertFalse("illegal class E IP should be invalid", validator.isValid("250.21.323.48")); 71 // CHECKSTYLE.OFF: SingleSpaceSeparator 72 assertTrue("class A IP should be valid", validator.isValid("24.25.231.12")); 73 assertFalse("illegal class A IP should be invalid", validator.isValid("2.41.32.324")); 74 75 assertTrue("class B IP should be valid", validator.isValid("135.14.44.12")); 76 assertFalse("illegal class B IP should be invalid", validator.isValid("154.123.441.123")); 77 78 assertTrue("class C IP should be valid", validator.isValid("213.25.224.32")); 79 assertFalse("illegal class C IP should be invalid", validator.isValid("201.543.23.11")); 80 81 assertTrue("class D IP should be valid", validator.isValid("229.35.159.6")); 82 assertFalse("illegal class D IP should be invalid", validator.isValid("231.54.11.987")); 83 84 assertTrue("class E IP should be valid", validator.isValid("248.85.24.92")); 85 assertFalse("illegal class E IP should be invalid", validator.isValid("250.21.323.48")); 86 // CHECKSTYLE.ON: SingleSpaceSeparator 83 87 } 84 88 … … 88 92 @Test 89 93 public void testReservedInetAddresses() { 90 assertTrue("localhost IP should be valid", 91 assertTrue("broadcast IP should be valid", 94 assertTrue("localhost IP should be valid", validator.isValid("127.0.0.1")); 95 assertTrue("broadcast IP should be valid", validator.isValid("255.255.255.255")); 92 96 } 93 97 … … 97 101 @Test 98 102 public void testBrokenInetAddresses() { 103 // CHECKSTYLE.OFF: SingleSpaceSeparator 99 104 assertFalse("IP with characters should be invalid", validator.isValid("124.14.32.abc")); 100 105 assertFalse("IP with leading zeroes should be invalid", validator.isValid("124.14.32.01")); 101 106 assertFalse("IP with three groups should be invalid", validator.isValid("23.64.12")); 102 107 assertFalse("IP with five groups should be invalid", validator.isValid("26.34.23.77.234")); 108 // CHECKSTYLE.ON: SingleSpaceSeparator 103 109 } 104 110 -
trunk/test/unit/org/openstreetmap/josm/data/validation/routines/RegexValidatorTest.java
r10338 r10378 37 37 public class RegexValidatorTest { 38 38 39 private static final String REGEX 39 private static final String REGEX = "^([abc]*)(?:\\-)([DEF]*)(?:\\-)([123]*)$"; 40 40 41 41 private static final String COMPONENT_1 = "([abc]{3})"; 42 42 private static final String COMPONENT_2 = "([DEF]{3})"; 43 43 private static final String COMPONENT_3 = "([123]{3})"; 44 private static final String SEPARATOR_1 45 private static final String SEPARATOR_2 44 private static final String SEPARATOR_1 = "(?:\\-)"; 45 private static final String SEPARATOR_2 = "(?:\\s)"; 46 46 private static final String REGEX_1 = "^" + COMPONENT_1 + SEPARATOR_1 + COMPONENT_2 + SEPARATOR_1 + COMPONENT_3 + "$"; 47 47 private static final String REGEX_2 = "^" + COMPONENT_1 + SEPARATOR_2 + COMPONENT_2 + SEPARATOR_2 + COMPONENT_3 + "$"; 48 48 private static final String REGEX_3 = "^" + COMPONENT_1 + COMPONENT_2 + COMPONENT_3 + "$"; 49 49 private static final String[] MULTIPLE_REGEX = new String[] {REGEX_1, REGEX_2, REGEX_3}; 50 51 // CHECKSTYLE.OFF: SingleSpaceSeparator 50 52 51 53 /** … … 85 87 86 88 // ------------ Set up Sensitive Validators 87 RegexValidator multiple 88 RegexValidator single1 89 RegexValidator single2 90 RegexValidator single3 89 RegexValidator multiple = new RegexValidator(MULTIPLE_REGEX); 90 RegexValidator single1 = new RegexValidator(REGEX_1); 91 RegexValidator single2 = new RegexValidator(REGEX_2); 92 RegexValidator single3 = new RegexValidator(REGEX_3); 91 93 92 94 // ------------ Set up test values … … 128 130 // ------------ Set up In-sensitive Validators 129 131 RegexValidator multiple = new RegexValidator(MULTIPLE_REGEX, false); 130 RegexValidator single1 131 RegexValidator single2 132 RegexValidator single3 132 RegexValidator single1 = new RegexValidator(REGEX_1, false); 133 RegexValidator single2 = new RegexValidator(REGEX_2, false); 134 RegexValidator single3 = new RegexValidator(REGEX_3, false); 133 135 134 136 // ------------ Set up test values … … 172 174 assertNull("Instance match()", validator.match(null)); 173 175 } 176 177 // CHECKSTYLE.ON: SingleSpaceSeparator 174 178 175 179 /** -
trunk/test/unit/org/openstreetmap/josm/data/validation/routines/UrlValidatorTest.java
r10338 r10378 99 99 int statusPerLine = 60; 100 100 int printed = 0; 101 if (printIndex) 101 if (printIndex) { 102 102 statusPerLine = 6; 103 103 }
Note:
See TracChangeset
for help on using the changeset viewer.