Changeset 18690 in josm


Ignore:
Timestamp:
2023-03-13T21:59:27+01:00 (3 months ago)
Author:
taylor.smock
Message:

See #16567: Convert all assertion calls to JUnit 5 (patch by gaben, modified)

The modifications are as follows:

  • Merge DomainValidatorTest.testIDN and DomainValidatorTest.testIDNJava6OrLater
  • Update some tests to use @ParameterizedTest (DomainValidatorTest)
  • Replace various exception blocks with assertThrows. These typically looked like
        try {
            // Something that should throw an exception here
            fail("An exception should have been thrown");
        } catch (Exception e) {
            // Verify the exception matches expectations here
        }
    
  • Replace assertTrue(val instanceof Clazz) with assertInstanceOf
  • Replace JUnit 4 @Suite with JUnit 5 @Suite

Both the original patch and the modified patch fix various lint issues.

Location:
trunk
Files:
106 edited

Legend:

Unmodified
Added
Removed
  • trunk/ivy.xml

    r18629 r18690  
    6161        <dependency conf="test->default" org="com.github.tomakehurst" name="wiremock-jre8" rev="2.35.0"/>
    6262        <dependency conf="test->default" org="io.github.classgraph" name="classgraph" rev="4.8.154"/>
    63         <dependency conf="test->default" org="org.junit.platform" name="junit-platform-launcher" rev="1.9.1"/>
    64         <dependency conf="test->default" org="org.junit.vintage" name="junit-vintage-engine" rev="5.9.1"/>
    65         <dependency conf="test->default" org="org.junit.jupiter" name="junit-jupiter-params" rev="5.9.1"/>
    66         <dependency conf="test->default" org="org.junit.jupiter" name="junit-jupiter-api" rev="5.9.1"/>
    67         <dependency conf="test->default" org="org.junit.jupiter" name="junit-jupiter-engine" rev="5.9.1"/>
    68         <dependency conf="test->default" org="org.junit.jupiter" name="junit-jupiter-migrationsupport" rev="5.9.1"/>
     63        <dependency conf="test->default" org="org.junit.platform" name="junit-platform-launcher" rev="1.9.2"/>
     64        <dependency conf="test->default" org="org.junit.platform" name="junit-platform-suite" rev="1.9.2"/>
     65        <dependency conf="test->default" org="org.junit.vintage" name="junit-vintage-engine" rev="5.9.2"/>
     66        <dependency conf="test->default" org="org.junit.jupiter" name="junit-jupiter-params" rev="5.9.2"/>
     67        <dependency conf="test->default" org="org.junit.jupiter" name="junit-jupiter-api" rev="5.9.2"/>
     68        <dependency conf="test->default" org="org.junit.jupiter" name="junit-jupiter-engine" rev="5.9.2"/>
     69        <dependency conf="test->default" org="org.junit.jupiter" name="junit-jupiter-migrationsupport" rev="5.9.2"/>
    6970        <dependency conf="test->default" org="net.trajano.commons" name="commons-testing" rev="2.1.0"/>
    7071        <dependency conf="test->default" org="nl.jqno.equalsverifier" name="equalsverifier" rev="3.12.3"/>
  • trunk/test/functional/org/openstreetmap/josm/io/MultiFetchServerObjectReaderTest.java

    r18203 r18690  
    1616import java.io.PrintWriter;
    1717import java.nio.charset.StandardCharsets;
     18import java.nio.file.Files;
    1819import java.security.SecureRandom;
    1920import java.text.MessageFormat;
     
    5253 */
    5354@SuppressFBWarnings(value = "CRLF_INJECTION_LOGS")
    54 @Timeout(value = 60, unit = TimeUnit.SECONDS)
     55@Timeout(value = 1, unit = TimeUnit.MINUTES)
    5556class MultiFetchServerObjectReaderTest {
    5657    private static final Logger logger = Logger.getLogger(MultiFetchServerObjectReader.class.getName());
     
    191192        try (
    192193            PrintWriter pw = new PrintWriter(
    193                     new OutputStreamWriter(new FileOutputStream(dataSetCacheOutputFile), StandardCharsets.UTF_8)
     194                    new OutputStreamWriter(Files.newOutputStream(dataSetCacheOutputFile.toPath()), StandardCharsets.UTF_8)
    194195        )) {
    195196            logger.info(MessageFormat.format("caching test data set in ''{0}'' ...", dataSetCacheOutputFile.toString()));
  • trunk/test/functional/org/openstreetmap/josm/tools/HttpClientTest.java

    r18437 r18690  
    240240    void testTooMuchRedirects() throws IOException {
    241241        mockRedirects(false, 3);
    242         assertThrows(IOException.class, () -> HttpClient.create(url("/relative-redirect/3")).setMaxRedirects(2).connect(progress));
     242        final HttpClient client = HttpClient.create(url("/relative-redirect/3")).setMaxRedirects(2);
     243        try {
     244            assertThrows(IOException.class, () -> client.connect(progress));
     245        } finally {
     246            client.disconnect();
     247        }
    243248    }
    244249
     
    370375    void testTakesTooLong() throws IOException {
    371376        mockDelay(1);
    372         assertThrows(IOException.class, () -> HttpClient.create(url("/delay/1")).setReadTimeout(500).connect(progress));
     377        final HttpClient client = HttpClient.create(url("/delay/1")).setReadTimeout(500);
     378        try {
     379            assertThrows(IOException.class, () -> client.connect(progress));
     380        } finally {
     381            client.disconnect();
     382        }
    373383    }
    374384
     
    387397
    388398    /**
    389      * Test of {@link Response#uncompress} method with Gzip compression.
     399     * Test of {@link Response#uncompress(boolean)} method with Gzip compression.
    390400     * @throws IOException if any I/O error occurs
    391401     */
     
    407417
    408418    /**
    409      * Test of {@link Response#uncompress} method with Bzip compression.
     419     * Test of {@link Response#uncompress(boolean)} method with Bzip compression.
    410420     * @throws IOException if any I/O error occurs
    411421     */
     
    427437
    428438    /**
    429      * Test of {@link Response#uncompress} method with Bzip compression.
     439     * Test of {@link Response#uncompress(boolean)} method with Bzip compression.
    430440     * @throws IOException if any I/O error occurs
    431441     */
  • trunk/test/performance/org/openstreetmap/josm/data/osm/KeyValuePerformanceTest.java

    r17275 r18690  
    33
    44import static org.junit.jupiter.api.Assertions.assertEquals;
    5 import static org.junit.jupiter.api.Assertions.assertFalse;
     5import static org.junit.jupiter.api.Assertions.assertNotEquals;
    66import static org.junit.jupiter.api.Assertions.assertNotSame;
    77import static org.junit.jupiter.api.Assertions.assertSame;
     
    1414
    1515import org.apache.commons.lang3.RandomStringUtils;
    16 import org.junit.Before;
     16import org.junit.jupiter.api.BeforeEach;
    1717import org.junit.jupiter.api.Test;
    1818import org.junit.jupiter.api.Timeout;
     
    2929 * @author Michael Zangl
    3030 */
    31 @Timeout(value = 15*60, unit = TimeUnit.SECONDS)
     31@Timeout(value = 15, unit = TimeUnit.MINUTES)
    3232class KeyValuePerformanceTest {
    3333    private static final int PUT_RUNS = 10000;
     
    9696        timer = PerformanceTestUtils.startTimer("str1.equals(str2) = fails (without intern)");
    9797        for (int i = 0; i < STRING_INTERN_TESTS; i++) {
    98             assertFalse(str1.equals(str2));
     98            assertNotEquals(str1, str2);
    9999        }
    100100        timer.done();
     
    116116     * Generate an array of test strings.
    117117     */
    118     @Before
     118    @BeforeEach
    119119    public void generateTestStrings() {
    120120        testStrings.clear();
  • trunk/test/performance/org/openstreetmap/josm/data/osm/visitor/paint/AbstractMapRendererPerformanceTestParent.java

    r17615 r18690  
    3131 * Abstract superclass of {@code StyledMapRendererPerformanceTest} and {@code WireframeMapRendererPerformanceTest}.
    3232 */
    33 @Timeout(value = 15*60, unit = TimeUnit.SECONDS)
     33@Timeout(value = 15, unit = TimeUnit.MINUTES)
    3434abstract class AbstractMapRendererPerformanceTestParent {
    3535
     
    7979        try (InputStream fisR = Files.newInputStream(Paths.get("nodist/data/restriction.osm"));
    8080             InputStream fisM = Files.newInputStream(Paths.get("nodist/data/multipolygon.osm"));
    81              InputStream fisO = Compression.getUncompressedFileInputStream(new File("nodist/data/overpass-download.osm.bz2"));) {
     81             InputStream fisO = Compression.getUncompressedFileInputStream(new File("nodist/data/overpass-download.osm.bz2"))) {
    8282            dsRestriction = OsmReader.parseDataSet(fisR, NullProgressMonitor.INSTANCE);
    8383            dsMultipolygon = OsmReader.parseDataSet(fisM, NullProgressMonitor.INSTANCE);
     
    125125    }
    126126
    127     @Test
    128127    /**
    129128     * Complex polygon (Lake Ontario) with small download area.
    130129     */
     130    @Test
    131131    void testOverpassDownload() throws Exception {
    132132        test(20, dsOverpass, new Bounds(43.4510496, -76.536684, 43.4643202, -76.4954853));
  • trunk/test/performance/org/openstreetmap/josm/gui/mappaint/MapRendererPerformanceTest.java

    r17615 r18690  
    33
    44import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertNotNull;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
    57
    68import java.awt.Color;
     
    2123import javax.imageio.ImageIO;
    2224
    23 import org.junit.Assert;
    2425import org.junit.jupiter.api.AfterAll;
    2526import org.junit.jupiter.api.BeforeAll;
     
    125126        List<StyleSource> sources = MapPaintStyles.getStyles().getStyleSources();
    126127        filterStyleIdx = sources.indexOf(filterStyle);
    127         Assert.assertEquals(2, filterStyleIdx);
    128 
    129         Assert.assertEquals(Feature.values().length, filterStyle.settings.size());
     128        assertEquals(2, filterStyleIdx);
     129
     130        assertEquals(Feature.values().length, filterStyle.settings.size());
    130131        for (StyleSetting set : filterStyle.settings) {
    131132            BooleanStyleSetting bset = (BooleanStyleSetting) set;
     
    139140                }
    140141            }
    141             Assert.assertTrue(prefKey, found);
     142            assertTrue(found, prefKey);
    142143        }
    143144
     
    151152            }
    152153        }
    153         Assert.assertNotNull(defaultStyle);
     154        assertNotNull(defaultStyle);
    154155
    155156        for (StyleSetting set : defaultStyle.settings) {
     
    161162            }
    162163        }
    163         Assert.assertNotNull(hideIconsSetting);
     164        assertNotNull(hideIconsSetting);
    164165        hideIconsSetting.setValue(false);
    165166        MapPaintStyleLoader.reloadStyles(defaultStyleIdx);
     
    209210            if (checkScale) {
    210211                int lvl = Selector.GeneralSelector.scale2level(nc.getDist100Pixel());
    211                 Assert.assertEquals(17, lvl);
     212                assertEquals(17, lvl);
    212213            }
    213214
     
    360361
    361362        public void dumpTimes() {
    362             System.out.print(String.format("gen. %4d, sort %4d, draw %4d%n", getGenerateTime(), getSortTime(), getDrawTime()));
     363            System.out.printf("gen. %4d, sort %4d, draw %4d%n", getGenerateTime(), getSortTime(), getDrawTime());
    363364        }
    364365
  • trunk/test/performance/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSourceFilterTest.java

    r17275 r18690  
    1818 * @author Michael Zangl
    1919 */
    20 @Timeout(value = 15*60, unit = TimeUnit.SECONDS)
     20@Timeout(value = 15, unit = TimeUnit.MINUTES)
    2121class MapCSSStyleSourceFilterTest {
    2222
     
    7171
    7272        private void addRule(String selector) {
    73             sb.append(selector + " {}\n");
     73            sb.append(selector).append(" {}\n");
    7474        }
    7575
  • trunk/test/performance/org/openstreetmap/josm/io/OsmReaderPerformanceTest.java

    r17615 r18690  
    1010import java.io.IOException;
    1111import java.io.InputStream;
     12import java.nio.file.Files;
    1213import java.util.concurrent.TimeUnit;
    1314
     
    2728 * @author Michael Zangl
    2829 */
    29 @Timeout(value = 15*60, unit = TimeUnit.SECONDS)
     30@Timeout(value = 15, unit = TimeUnit.MINUTES)
    3031class OsmReaderPerformanceTest {
    3132    private static final int TIMES = 4;
     
    7374    private InputStream loadFile(boolean decompressBeforeRead) throws IOException {
    7475        File file = new File(PerformanceTestUtils.DATA_FILE);
    75         try (InputStream is = decompressBeforeRead ? Compression.getUncompressedFileInputStream(file) : new FileInputStream(file)) {
     76        try (InputStream is = decompressBeforeRead ? Compression.getUncompressedFileInputStream(file) : Files.newInputStream(file.toPath())) {
    7677            ByteArrayOutputStream temporary = new ByteArrayOutputStream();
    7778            byte[] readBuffer = new byte[4096];
  • trunk/test/performance/org/openstreetmap/josm/io/OsmWriterPerformanceTest.java

    r17848 r18690  
    2020 * For this, we use the neubrandenburg-file, which is a good real world example of an OSM file.
    2121 */
    22 @Timeout(value = 15*60, unit = TimeUnit.SECONDS)
     22@Timeout(value = 15, unit = TimeUnit.MINUTES)
    2323class OsmWriterPerformanceTest {
    2424    private static final int TIMES = 4;
  • trunk/test/unit/org/openstreetmap/josm/JOSMFixture.java

    r18208 r18690  
    117117        I18n.init();
    118118        // initialize the platform hook, and
    119         // call the really early hook before we anything else
     119        // call the really early hook before anything else
    120120        PlatformManager.getPlatform().preStartupHook();
    121121
     
    150150
    151151        if (createGui) {
    152             GuiHelper.runInEDTAndWaitWithException(() -> setupGUI());
     152            GuiHelper.runInEDTAndWaitWithException(this::setupGUI);
    153153        }
    154154    }
  • trunk/test/unit/org/openstreetmap/josm/actions/CopyActionTest.java

    r18487 r18690  
    44import static org.junit.jupiter.api.Assertions.assertEquals;
    55import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertInstanceOf;
    67import static org.junit.jupiter.api.Assertions.assertNotNull;
    78import static org.junit.jupiter.api.Assertions.assertTrue;
     
    111112        Object copied = ClipboardUtils.getClipboard().getContents(null).getTransferData(PrimitiveTransferData.DATA_FLAVOR);
    112113        assertNotNull(copied);
    113         assertTrue(copied instanceof PrimitiveTransferData);
    114         PrimitiveTransferData ptd = (PrimitiveTransferData) copied;
     114        PrimitiveTransferData ptd = assertInstanceOf(PrimitiveTransferData.class, copied);
    115115        Object[] direct = ptd.getDirectlyAdded().toArray();
    116116        assertEquals(1, direct.length);
  • trunk/test/unit/org/openstreetmap/josm/actions/JoinAreasActionTest.java

    r17275 r18690  
    33
    44import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertInstanceOf;
    56import static org.junit.jupiter.api.Assertions.assertTrue;
    67
     
    199200            Collection<OsmPrimitive> primitives = tests.get(test);
    200201            for (OsmPrimitive osm : primitives) {
    201                 assertTrue(osm instanceof Way, test + "; expected way, but got: " + osm);
     202                assertInstanceOf(Way.class, osm, test + "; expected way, but got: " + osm);
    202203            }
    203204            new JoinAreasAction(false).join((Collection) primitives);
  • trunk/test/unit/org/openstreetmap/josm/actions/RestorePropertyActionTest.java

    r17996 r18690  
    22package org.openstreetmap.josm.actions;
    33
    4 import static org.junit.jupiter.api.Assertions.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertInstanceOf;
    55
    66import javax.swing.DefaultListSelectionModel;
     
    4545        UndoRedoHandler.getInstance().clean();
    4646        new RestorePropertyAction(k -> key, v -> val, () -> n, selModel).actionPerformed(null);
    47         assertTrue(UndoRedoHandler.getInstance().getLastCommand() instanceof ChangePropertyCommand);
     47        assertInstanceOf(ChangePropertyCommand.class, UndoRedoHandler.getInstance().getLastCommand());
    4848    }
    4949}
  • trunk/test/unit/org/openstreetmap/josm/actions/SessionSaveActionTest.java

    r18466 r18690  
    22package org.openstreetmap.josm.actions;
    33
    4 import static org.junit.Assert.assertFalse;
    54import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
    66import static org.junit.jupiter.api.Assertions.assertTrue;
    77
  • trunk/test/unit/org/openstreetmap/josm/actions/SplitWayActionTest.java

    r17275 r18690  
    77import java.util.Arrays;
    88
    9 import org.junit.Assert;
    109import org.junit.jupiter.api.Test;
    1110import org.junit.jupiter.api.extension.RegisterExtension;
     
    5958        w1.setNodes(Arrays.asList(w1NodesArray));
    6059        Way w2 = new Way();
    61         w2.setNodes(Arrays.asList(new Node[] {n1, n2, n3, n1, n4, n5, n1}));
     60        w2.setNodes(Arrays.asList(n1, n2, n3, n1, n4, n5, n1));
    6261        dataSet.addPrimitive(w1);
    6362        dataSet.addPrimitive(w2);
     
    109108        for (RelationMember member : restriction.getMembers()) {
    110109            if ("from".equals(member.getRole())) {
    111                 Assert.assertTrue(member.getWay().containsNode(via));
     110                assertTrue(member.getWay().containsNode(via));
    112111            }
    113112        }
  • trunk/test/unit/org/openstreetmap/josm/actions/corrector/ReverseWayTagCorrectorTest.java

    r17289 r18690  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.actions.corrector;
     3
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
    37
    48import java.util.Collections;
     
    711import java.util.stream.Stream;
    812
    9 import org.junit.Assert;
    1013import org.junit.jupiter.api.Test;
    1114import org.junit.jupiter.api.extension.RegisterExtension;
     
    105108
    106109    private void assertSwitch(Tag oldTag, Tag newTag) {
    107         Assert.assertEquals(newTag, ReverseWayTagCorrector.TagSwitcher.apply(oldTag));
     110        assertEquals(newTag, ReverseWayTagCorrector.TagSwitcher.apply(oldTag));
    108111    }
    109112
     
    128131    void testSwitchingWayNodes() {
    129132        final Map<OsmPrimitive, List<TagCorrection>> tagCorrections = getTagCorrectionsForWay("direction=forward");
    130         Assert.assertEquals(1, tagCorrections.size());
    131         Assert.assertEquals(Collections.singletonList(new TagCorrection("direction", "forward", "direction", "backward")),
     133        assertEquals(1, tagCorrections.size());
     134        assertEquals(Collections.singletonList(new TagCorrection("direction", "forward", "direction", "backward")),
    132135                tagCorrections.values().iterator().next());
    133136    }
     
    138141    @Test
    139142    void testNotSwitchingWayNodes() {
    140         Assert.assertEquals(0, getTagCorrectionsForWay("direction=SSW").size());
    141         Assert.assertEquals(0, getTagCorrectionsForWay("direction=145").size());
     143        assertEquals(0, getTagCorrectionsForWay("direction=SSW").size());
     144        assertEquals(0, getTagCorrectionsForWay("direction=145").size());
    142145    }
    143146
     
    148151    void testIsReversible() {
    149152        Way w0 = buildWayWithMiddleNode("highway=stop");
    150         Assert.assertTrue(ReverseWayTagCorrector.isReversible(w0));
     153        assertTrue(ReverseWayTagCorrector.isReversible(w0));
    151154        Way w1 = buildWayWithMiddleNode("direction=forward");
    152         Assert.assertFalse(ReverseWayTagCorrector.isReversible(w1));
    153         Assert.assertEquals(3, w1.getNodesCount());
     155        assertFalse(ReverseWayTagCorrector.isReversible(w1));
     156        assertEquals(3, w1.getNodesCount());
    154157        w1.getNodes().forEach(n -> n.setKeys(null));
    155         Assert.assertTrue(ReverseWayTagCorrector.isReversible(w1));
     158        assertTrue(ReverseWayTagCorrector.isReversible(w1));
    156159        w1.put("oneway", "yes");
    157         Assert.assertFalse(ReverseWayTagCorrector.isReversible(w1));
     160        assertFalse(ReverseWayTagCorrector.isReversible(w1));
    158161    }
    159162
  • trunk/test/unit/org/openstreetmap/josm/actions/upload/FixDataHookTest.java

    r17275 r18690  
    44import static org.junit.jupiter.api.Assertions.assertEquals;
    55import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertNotEquals;
    67import static org.junit.jupiter.api.Assertions.assertNotNull;
    78import static org.junit.jupiter.api.Assertions.assertTrue;
     
    99100        assertTrue(w2.hasKey("ford"));
    100101
    101         assertFalse("false".equals(w3.get("oneway")));
    102         assertTrue("no".equals(w3.get("oneway")));
     102        assertNotEquals("false", w3.get("oneway"));
     103        assertEquals("no", w3.get("oneway"));
    103104
    104         assertFalse("0".equals(w4.get("oneway")));
    105         assertTrue("no".equals(w4.get("oneway")));
     105        assertNotEquals("0", w4.get("oneway"));
     106        assertEquals("no", w4.get("oneway"));
    106107
    107         assertFalse("true".equals(w5.get("oneway")));
    108         assertTrue("yes".equals(w5.get("oneway")));
     108        assertNotEquals("true", w5.get("oneway"));
     109        assertEquals("yes", w5.get("oneway"));
    109110
    110         assertFalse("1".equals(w6.get("oneway")));
    111         assertTrue("yes".equals(w6.get("oneway")));
     111        assertNotEquals("1", w6.get("oneway"));
     112        assertEquals("yes", w6.get("oneway"));
    112113
    113114        assertFalse(w7.hasKey("highway"));
    114115        assertTrue(w7.hasKey("barrier"));
    115116
    116         assertFalse("multipolygon".equals(r1.get("type")));
    117         assertTrue("boundary".equals(r1.get("type")));
     117        assertNotEquals("multipolygon", r1.get("type"));
     118        assertEquals("boundary", r1.get("type"));
    118119
    119         assertTrue("space_end".equals(r2.get("foo")));
    120         assertTrue("space_begin".equals(r2.get("bar")));
    121         assertTrue("space_both".equals(r2.get("baz")));
     120        assertEquals("space_end", r2.get("foo"));
     121        assertEquals("space_begin", r2.get("bar"));
     122        assertEquals("space_both", r2.get("baz"));
    122123        assertFalse(r2.hasKey(" space_begin"));
    123124        assertFalse(r2.hasKey("space_end "));
  • trunk/test/unit/org/openstreetmap/josm/command/AddPrimitivesCommandTest.java

    r18037 r18690  
    99import java.util.ArrayList;
    1010import java.util.Arrays;
     11import java.util.Collections;
    1112import java.util.HashSet;
    1213import java.util.List;
     
    115116
    116117        AddPrimitivesCommand command1 = new AddPrimitivesCommand(testData, ds);
    117         AddPrimitivesCommand command2 = new AddPrimitivesCommand(Arrays.<PrimitiveData>asList(data2), ds);
     118        AddPrimitivesCommand command2 = new AddPrimitivesCommand(Collections.singletonList(data2), ds);
    118119
    119120        assertEquals("Added 3 objects", command1.getDescriptionText());
     
    342343        way.put("test", "test");
    343344        way.setNodeIds(Arrays.asList(node1.getId(), node2.getId()));
    344         List<PrimitiveData> testData = Arrays.<PrimitiveData>asList(node1, node2, way);
    345         return testData;
     345        return Arrays.asList(node1, node2, way);
    346346    }
    347347
  • trunk/test/unit/org/openstreetmap/josm/command/ChangeCommandTest.java

    r18037 r18690  
    6969
    7070        assertEquals("new", testData.existingNode.get("new"));
    71         assertEquals(null, testData.existingNode.get("existing"));
     71        assertNull(testData.existingNode.get("existing"));
    7272        assertEquals(LatLon.NORTH_POLE, testData.existingNode.getCoor());
    7373
     
    8989        newNode.setCoor(LatLon.NORTH_POLE);
    9090
    91         assertThrows(DataIntegrityProblemException.class, () -> new ChangeCommand(testData.existingNode, newNode).executeCommand());
     91        final ChangeCommand changeCommand = new ChangeCommand(testData.existingNode, newNode);
     92        assertThrows(DataIntegrityProblemException.class, changeCommand::executeCommand);
    9293    }
    9394
  • trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxImageCorrelationTest.java

    r18061 r18690  
    116116    void testMatchGpxTrack1() {
    117117        assertEquals(7, GpxImageCorrelation.matchGpxTrack(images, gpx, new GpxImageCorrelationSettings(0, false)));
    118         assertEquals(null, ib.getPos());
     118        assertNull(ib.getPos());
    119119        assertEquals(new CachedLatLon(47.19286847859621, 8.79732714034617), i0.getPos()); // start of track
    120120        assertEquals(new CachedLatLon(47.196979885920882, 8.79541271366179), i1.getPos()); // exact match
     
    133133        // First waypoint has no speed in matchGpxTrack(). Speed is calculated
    134134        // and not taken from GPX track.
    135         assertEquals(null, ib.getSpeed());
    136         assertEquals(null, i0.getSpeed());
    137         assertEquals(Double.valueOf(11.675317966018756), i1.getSpeed(), 0.000001);
    138         assertEquals(Double.valueOf(24.992418392716967), i2.getSpeed(), 0.000001);
    139         assertEquals(Double.valueOf(27.307968754679223), i3.getSpeed(), 0.000001);
    140         assertEquals(null, ib.getElevation());
    141         assertEquals(null, i0.getElevation());
    142         assertEquals(Double.valueOf(489.29), i1.getElevation(), 0.000001);
    143         assertEquals(Double.valueOf((490.40 + 489.75) / 2), i2.getElevation(), 0.000001);
    144         assertEquals(Double.valueOf(486.368333333), i3.getElevation(), 0.000001);
     135        assertNull(ib.getSpeed());
     136        assertNull(i0.getSpeed());
     137        assertEquals(11.675317966018756, i1.getSpeed(), 0.000001);
     138        assertEquals(24.992418392716967, i2.getSpeed(), 0.000001);
     139        assertEquals(27.307968754679223, i3.getSpeed(), 0.000001);
     140        assertNull(ib.getElevation());
     141        assertNull(i0.getElevation());
     142        assertEquals(489.29, i1.getElevation(), 0.000001);
     143        assertEquals((490.40 + 489.75) / 2, i2.getElevation(), 0.000001);
     144        assertEquals(486.368333333, i3.getElevation(), 0.000001);
    145145        // interpolated elevation between trackpoints with interpolated timestamps
    146         assertEquals(Double.valueOf(475.393978719), i4.getElevation(), 0.000001);
    147         assertEquals(null, i5.getElevation());
    148         assertEquals(null, i6.getElevation());
    149 
    150         assertEquals(null, ib.getGpsInstant());
     146        assertEquals(475.393978719, i4.getElevation(), 0.000001);
     147        assertNull(i5.getElevation());
     148        assertNull(i6.getElevation());
     149
     150        assertNull(ib.getGpsInstant());
    151151        assertEquals(DateUtils.parseInstant("2016:01:03 11:59:54"), i0.getGpsInstant()); // original time is kept
    152152        assertEquals(DateUtils.parseInstant("2016:01:03 12:04:01"), i1.getGpsInstant());
     
    168168
    169169        assertEquals(4, GpxImageCorrelation.matchGpxTrack(images, gpx, new GpxImageCorrelationSettings(0, false)));
    170         assertEquals(null, ib.getPos());
    171         assertEquals(null, i0.getPos());
     170        assertNull(ib.getPos());
     171        assertNull(i0.getPos());
    172172        assertEquals(new CachedLatLon(47.196979885920882, 8.79541271366179), i1.getPos());
    173173        assertEquals(new CachedLatLon((47.197131179273129 + 47.197186248376966) / 2,
     
    175175        assertEquals(new CachedLatLon(47.197319911792874, 8.792139580473304), i3.getPos());
    176176        assertEquals(new CachedLatLon(47.197568312311816, 8.790292849679897), i4.getPos());
    177         assertEquals(null, i5.getPos());
    178         assertEquals(null, i6.getPos());
     177        assertNull(i5.getPos());
     178        assertNull(i6.getPos());
    179179    }
    180180
     
    196196
    197197        assertEquals(6, GpxImageCorrelation.matchGpxTrack(images, gpx, new GpxImageCorrelationSettings(0, false)));
    198         assertEquals(null, ib.getPos());
     198        assertNull(ib.getPos());
    199199        assertEquals(new CachedLatLon(47.19286847859621, 8.79732714034617), i0.getPos());
    200200        assertEquals(new CachedLatLon(47.196979885920882, 8.79541271366179), i1.getPos());
     
    204204        assertEquals(new CachedLatLon(47.197568312311816, 8.790292849679897), i4.getPos());
    205205        assertEquals(new CachedLatLon(47.19819249585271, 8.78536943346262), i5.getPos());
    206         assertEquals(null, i6.getPos());
     206        assertNull(i6.getPos());
    207207        assertEquals(new CachedLatLon(1, 2), i7.getPos());
    208208    }
     
    228228        assertEquals(new CachedLatLon(47.19985828931693, 8.77969308585768), i6.getPos()); // different values than in tests #1 and #3!
    229229
    230         assertEquals(Double.valueOf(447.894014085), i5.getElevation(), 0.000001);
    231         assertEquals(Double.valueOf(437.395070423), i6.getElevation(), 0.000001);
     230        assertEquals(447.894014085, i5.getElevation(), 0.000001);
     231        assertEquals(437.395070423, i6.getElevation(), 0.000001);
    232232
    233233        assertEquals(new CachedLatLon(47.20126815140247, 8.77192972227931), i7.getPos());
     
    265265        assertEquals(new CachedLatLon(47.19985828931693, 8.77969308585768), i6.getPos());
    266266
    267         assertEquals(Double.valueOf(447.894014085), i5.getElevation(), 0.000001);
    268         assertEquals(Double.valueOf(437.395070423), i6.getElevation(), 0.000001);
     267        assertEquals(447.894014085, i5.getElevation(), 0.000001);
     268        assertEquals(437.395070423, i6.getElevation(), 0.000001);
    269269
    270270        assertEquals(new CachedLatLon(47.20126815140247, 8.77192972227931), i7.getPos());
  • trunk/test/unit/org/openstreetmap/josm/data/osm/ChangesetTest.java

    r17717 r18690  
    66import static org.junit.jupiter.api.Assertions.assertNull;
    77import static org.junit.jupiter.api.Assertions.assertTrue;
     8import static org.junit.jupiter.api.Assertions.fail;
    89import static org.openstreetmap.josm.data.osm.Changeset.MAX_CHANGESET_TAG_LENGTH;
    910
     
    1617import java.util.stream.IntStream;
    1718
    18 import org.junit.Assert;
    1919import org.junit.jupiter.api.extension.RegisterExtension;
    2020import org.junit.jupiter.api.Test;
     
    4848        try {
    4949            cs.setKeys(null);
    50             Assert.fail("Should have thrown an IllegalArgumentException as we gave a null argument.");
     50            fail("Should have thrown an IllegalArgumentException as we gave a null argument.");
    5151        } catch (IllegalArgumentException e) {
    5252            Logging.trace(e);
     
    6363        keys.put("test", "test");
    6464        cs.setKeys(keys);
    65         Assert.assertEquals("Both valid keys should have been put in the ChangeSet.", 2, cs.getKeys().size());
     65        assertEquals(2, cs.getKeys().size(), "Both valid keys should have been put in the ChangeSet.");
    6666
    6767        // Add a map with too long values => IllegalArgumentException
     
    7171        try {
    7272            cs.setKeys(keys);
    73             Assert.fail("Should have thrown an IllegalArgumentException as we gave a too long value.");
     73            fail("Should have thrown an IllegalArgumentException as we gave a too long value.");
    7474        } catch (IllegalArgumentException e) {
    7575            Logging.trace(e);
  • trunk/test/unit/org/openstreetmap/josm/data/osm/DataSetMergerTest.java

    r17749 r18690  
    10011001        //-- merge it
    10021002        DataSetMerger visitor = new DataSetMerger(my, their);
    1003         assertThrows(DataIntegrityProblemException.class, () -> visitor.merge());
     1003        assertThrows(DataIntegrityProblemException.class, visitor::merge);
    10041004    }
    10051005
  • trunk/test/unit/org/openstreetmap/josm/data/osm/DataSetTest.java

    r17283 r18690  
    44import static org.junit.jupiter.api.Assertions.assertEquals;
    55import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertInstanceOf;
    67import static org.junit.jupiter.api.Assertions.assertTrue;
    78
    89import java.util.ArrayList;
    910import java.util.Arrays;
     11import java.util.Collections;
    1012import java.util.HashSet;
    1113import java.util.List;
    1214
    13 import org.junit.Assert;
    1415import org.junit.jupiter.api.Test;
    1516import org.junit.jupiter.api.extension.RegisterExtension;
     
    4344        final DataSet ds = new DataSet();
    4445        // null bbox => empty list
    45         Assert.assertTrue(
    46             "Empty data set should produce an empty list.",
    47             ds.searchRelations(null).isEmpty()
    48         );
     46        assertTrue(ds.searchRelations(null).isEmpty(), "Empty data set should produce an empty list.");
    4947
    5048        // empty data set, any bbox => empty list
    5149        BBox bbox = new BBox(new LatLon(-180, -90), new LatLon(180, 90));
    52         Assert.assertTrue(
    53             "Empty data set should produce an empty list.",
    54             ds.searchRelations(bbox).isEmpty()
    55         );
     50        assertTrue(ds.searchRelations(bbox).isEmpty(), "Empty data set should produce an empty list.");
    5651
    5752        // data set with elements in the given bbox => these elements
     
    6459        bbox = new BBox(new LatLon(-1.0, -1.0), new LatLon(1.0, 1.0));
    6560        List<Relation> result = ds.searchRelations(bbox);
    66         Assert.assertEquals("We should have found only one item.", 1, result.size());
    67         Assert.assertTrue("The item found is relation r.", result.contains(r));
     61        assertEquals(1, result.size(), "We should have found only one item.");
     62        assertTrue(result.contains(r), "The item found is relation r.");
    6863    }
    6964
     
    7570        final DataSet ds = new DataSet();
    7671        // null bbox => empty list
    77         Assert.assertTrue("Empty data set should produce an empty list.", ds.searchPrimitives(null).isEmpty());
     72        assertTrue(ds.searchPrimitives(null).isEmpty(), "Empty data set should produce an empty list.");
    7873
    7974        // empty data set, any bbox => empty list
    8075        BBox bbox = new BBox(new LatLon(-180, -90), new LatLon(180, 90));
    81         Assert.assertTrue("Empty data set should produce an empty list.", ds.searchPrimitives(bbox).isEmpty());
     76        assertTrue(ds.searchPrimitives(bbox).isEmpty(), "Empty data set should produce an empty list.");
    8277        // data set with elements in the given bbox => these elements
    8378        Node node = new Node(LatLon.ZERO);
     
    9287        bbox = new BBox(new LatLon(-1.0, -1.0), new LatLon(1.0, 1.0));
    9388        List<OsmPrimitive> result = ds.searchPrimitives(bbox);
    94         Assert.assertEquals("We should have found four items.", 4, result.size());
     89        assertEquals(4, result.size(), "We should have found four items.");
    9590    }
    9691
     
    199194        ds.addPrimitive(n3);
    200195
    201         assertEquals(Arrays.asList(), new ArrayList<>(ds.getSelected()));
     196        assertEquals(Collections.emptyList(), new ArrayList<>(ds.getSelected()));
    202197
    203198        ds.setSelected(n1.getPrimitiveId(), n2.getPrimitiveId());
     
    205200
    206201        ds.clearSelection();
    207         assertEquals(Arrays.asList(), new ArrayList<>(ds.getSelected()));
     202        assertEquals(Collections.emptyList(), new ArrayList<>(ds.getSelected()));
    208203
    209204        ds.addSelected(n3.getPrimitiveId());
     
    311306    @Test
    312307    void testAddDataSourceListener() {
    313         DataSourceListener addListener = new DataSourceListener() {
    314             @Override
    315             public void dataSourceChange(DataSourceChangeEvent event) {
    316                 assertTrue(event instanceof DataSourceAddedEvent);
    317             }
    318         };
     308        DataSourceListener addListener = event -> assertInstanceOf(DataSourceAddedEvent.class, event);
    319309
    320310        DataSet ds = new DataSet();
     
    329319    @Test
    330320    void testRemoveDataSourceListener() {
    331         DataSourceListener removeListener = new DataSourceListener() {
    332             @Override
    333             public void dataSourceChange(DataSourceChangeEvent event) {
    334                 assertTrue(event instanceof DataSourceRemovedEvent);
    335             }
    336         };
     321        DataSourceListener removeListener = event -> assertInstanceOf(DataSourceRemovedEvent.class, event);
    337322
    338323        DataSet ds = new DataSet();
     
    356341        ds.addPrimitive(w);
    357342        Relation r = new Relation();
    358         r.setMembers(Arrays.asList(new RelationMember(null, w)));
     343        r.setMembers(Collections.singletonList(new RelationMember(null, w)));
    359344        ds.addPrimitive(r);
    360345        ds.lock();
  • trunk/test/unit/org/openstreetmap/josm/data/osm/FilterTest.java

    r17275 r18690  
    1111import java.util.Arrays;
    1212import java.util.Collection;
     13import java.util.Collections;
    1314import java.util.HashSet;
    1415import java.util.LinkedList;
     
    5253        ds.addPrimitive(n2);
    5354
    54         Collection<OsmPrimitive> all = new HashSet<>();
    55         all.addAll(Arrays.asList(new OsmPrimitive[] {n1, n2}));
    56 
    57         List<Filter> filters = new LinkedList<>();
     55        Collection<OsmPrimitive> all = new HashSet<>(Arrays.asList(n1, n2));
     56
    5857        Filter f1 = new Filter();
    5958        f1.text = "fixme";
    6059        f1.hiding = true;
    61         filters.addAll(Arrays.asList(new Filter[] {f1}));
     60        List<Filter> filters = new LinkedList<>(Collections.singletonList(f1));
    6261
    6362        FilterMatcher filterMatcher = new FilterMatcher();
     
    101100                Filter f2 = new Filter();
    102101                f2.text = "highway";
    103                 filters.addAll(Arrays.asList(new Filter[] {f1, f2}));
     102                filters.addAll(Arrays.asList(f1, f2));
    104103                break;
    105104            }
     
    120119                f2.text = "water";
    121120                f2.mode = SearchMode.remove;
    122                 filters.addAll(Arrays.asList(new Filter[] {f1, f2}));
     121                filters.addAll(Arrays.asList(f1, f2));
    123122                break;
    124123            }
     
    133132                Filter f3 = new Filter();
    134133                f3.text = "natural";
    135                 filters.addAll(Arrays.asList(new Filter[] {f1, f2, f3}));
     134                filters.addAll(Arrays.asList(f1, f2, f3));
    136135                break;
    137136            }
     
    151150                f4.text = "name";
    152151                f4.mode = SearchMode.remove;
    153                 filters.addAll(Arrays.asList(new Filter[] {f1, f2, f3, f4}));
     152                filters.addAll(Arrays.asList(f1, f2, f3, f4));
    154153                break;
    155154            }
     
    163162                f2.mode = SearchMode.remove;
    164163                f2.hiding = true; // Remove only hide flag so water should stay disabled
    165                 filters.addAll(Arrays.asList(new Filter[] {f1, f2}));
     164                filters.addAll(Arrays.asList(f1, f2));
    166165                break;
    167166            }
     
    183182                    if (!osm.get(key).equals(filterCode(osm))) {
    184183                        failedPrimitives.append(String.format(
    185                                 "Object %s. Expected [%s] but was [%s]%n", osm.toString(), osm.get(key), filterCode(osm)));
     184                                "Object %s. Expected [%s] but was [%s]%n", osm, osm.get(key), filterCode(osm)));
    186185                    }
    187186                }
     
    189188            assertTrue(foundAtLeastOne);
    190189            if (failedPrimitives.length() != 0)
    191                 throw new AssertionError(String.format("Run #%d%n%s", i, failedPrimitives.toString()));
     190                throw new AssertionError(String.format("Run #%d%n%s", i, failedPrimitives));
    192191        }
    193192    }
  • trunk/test/unit/org/openstreetmap/josm/data/osm/NodeDataTest.java

    r17275 r18690  
    22package org.openstreetmap.josm.data.osm;
    33
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    45import static org.junit.jupiter.api.Assertions.assertNull;
    56import static org.junit.jupiter.api.Assertions.assertTrue;
     
    1112import java.io.ObjectOutputStream;
    1213
    13 import org.junit.Assert;
    1414import org.junit.jupiter.api.Test;
    1515import org.openstreetmap.josm.data.coor.LatLon;
     
    3838        data.setChangesetId(314159);
    3939        final NodeData readData = serializeUnserialize(data);
    40         Assert.assertEquals(data.toString(), readData.toString());
     40        assertEquals(data.toString(), readData.toString());
    4141    }
    4242
  • trunk/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveKeyHandlingTest.java

    r17587 r18690  
    6767        n.put("key.1", "value.1");
    6868        n.put("key.2", "value.2");
    69         assertTrue(n.get("key.1").equals("value.1"));
    70         assertTrue(n.get("key.2").equals("value.2"));
     69        assertEquals("value.1", n.get("key.1"));
     70        assertEquals("value.2", n.get("key.2"));
    7171        testKeysSize(n, 2);
    7272        assertTrue(n.hasKeys());
  • trunk/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveTest.java

    r17275 r18690  
    22package org.openstreetmap.josm.data.osm;
    33
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    45import static org.junit.jupiter.api.Assertions.assertThrows;
    56
     
    78import java.util.HashSet;
    89
    9 import org.junit.Assert;
    1010import org.junit.jupiter.api.BeforeAll;
    1111import org.junit.jupiter.api.Test;
     
    3131
    3232    private void compareReferrers(OsmPrimitive actual, OsmPrimitive... expected) {
    33         Assert.assertEquals(new HashSet<>(Arrays.asList(expected)),
    34                 new HashSet<>(actual.getReferrers()));
     33        assertEquals(new HashSet<>(Arrays.asList(expected)), new HashSet<>(actual.getReferrers()));
    3534    }
    3635
     
    149148        new Way(w1);
    150149
    151         Assert.assertEquals(n.getReferrers().size(), 1);
    152         Assert.assertEquals(n.getReferrers().get(0), w1);
     150        assertEquals(n.getReferrers().size(), 1);
     151        assertEquals(n.getReferrers().get(0), w1);
    153152    }
    154153
     
    156155    void testCheckMustBeInDatasate() {
    157156        Node n = new Node();
    158         assertThrows(DataIntegrityProblemException.class, () -> n.getReferrers());
     157        assertThrows(DataIntegrityProblemException.class, n::getReferrers);
    159158    }
    160159}
  • trunk/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveTypeTest.java

    r17275 r18690  
    33
    44import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertInstanceOf;
    56import static org.junit.jupiter.api.Assertions.assertNull;
     7import static org.junit.jupiter.api.Assertions.assertSame;
    68import static org.junit.jupiter.api.Assertions.assertTrue;
    79import static org.junit.jupiter.api.Assertions.assertThrows;
     
    5153    @Test
    5254    void testGetOsmClass() {
    53         assertEquals(Node.class, OsmPrimitiveType.NODE.getOsmClass());
    54         assertEquals(Way.class, OsmPrimitiveType.WAY.getOsmClass());
    55         assertEquals(Relation.class, OsmPrimitiveType.RELATION.getOsmClass());
     55        assertSame(Node.class, OsmPrimitiveType.NODE.getOsmClass());
     56        assertSame(Way.class, OsmPrimitiveType.WAY.getOsmClass());
     57        assertSame(Relation.class, OsmPrimitiveType.RELATION.getOsmClass());
    5658        assertNull(OsmPrimitiveType.CLOSEDWAY.getOsmClass());
    5759        assertNull(OsmPrimitiveType.MULTIPOLYGON.getOsmClass());
     
    6365    @Test
    6466    void testGetDataClass() {
    65         assertEquals(NodeData.class, OsmPrimitiveType.NODE.getDataClass());
    66         assertEquals(WayData.class, OsmPrimitiveType.WAY.getDataClass());
    67         assertEquals(RelationData.class, OsmPrimitiveType.RELATION.getDataClass());
    68         assertEquals(WayData.class, OsmPrimitiveType.CLOSEDWAY.getDataClass());
    69         assertEquals(RelationData.class, OsmPrimitiveType.MULTIPOLYGON.getDataClass());
     67        assertSame(NodeData.class, OsmPrimitiveType.NODE.getDataClass());
     68        assertSame(WayData.class, OsmPrimitiveType.WAY.getDataClass());
     69        assertSame(RelationData.class, OsmPrimitiveType.RELATION.getDataClass());
     70        assertSame(WayData.class, OsmPrimitiveType.CLOSEDWAY.getDataClass());
     71        assertSame(RelationData.class, OsmPrimitiveType.MULTIPOLYGON.getDataClass());
    7072    }
    7173
     
    140142        OsmPrimitive r = OsmPrimitiveType.RELATION.newInstance(3, false);
    141143
    142         assertTrue(n instanceof Node);
    143         assertTrue(w instanceof Way);
    144         assertTrue(r instanceof Relation);
     144        assertInstanceOf(Node.class, n);
     145        assertInstanceOf(Way.class, w);
     146        assertInstanceOf(Relation.class, r);
    145147
    146148        assertEquals(1, n.getId());
     
    166168        OsmPrimitive r = OsmPrimitiveType.RELATION.newVersionedInstance(3, 6);
    167169
    168         assertTrue(n instanceof Node);
    169         assertTrue(w instanceof Way);
    170         assertTrue(r instanceof Relation);
     170        assertInstanceOf(Node.class, n);
     171        assertInstanceOf(Way.class, w);
     172        assertInstanceOf(Relation.class, r);
    171173
    172174        assertEquals(1, n.getId());
  • trunk/test/unit/org/openstreetmap/josm/data/osm/OsmUtilsTest.java

    r17586 r18690  
    44import static org.junit.jupiter.api.Assertions.assertEquals;
    55import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertInstanceOf;
    67import static org.junit.jupiter.api.Assertions.assertNull;
    78import static org.junit.jupiter.api.Assertions.assertTrue;
     
    3536    void testCreatePrimitive() {
    3637        final OsmPrimitive p = OsmUtils.createPrimitive("way name=Foo railway=rail");
    37         assertTrue(p instanceof Way);
     38        assertInstanceOf(Way.class, p);
    3839        assertEquals(2, p.getKeys().size());
    3940        assertEquals("Foo", p.get("name"));
  • trunk/test/unit/org/openstreetmap/josm/data/osm/QuadBucketsTest.java

    r17275 r18690  
    22package org.openstreetmap.josm.data.osm;
    33
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
    47import static org.openstreetmap.josm.TestUtils.getPrivateField;
    58
     
    1114import java.util.Arrays;
    1215import java.util.Collection;
     16import java.util.Collections;
    1317import java.util.Iterator;
    1418import java.util.List;
    1519import java.util.Random;
    1620
    17 import org.junit.Assert;
    1821import org.junit.jupiter.api.extension.RegisterExtension;
    1922import org.junit.jupiter.api.Test;
     
    6366            ds.removePrimitive(o);
    6467        }
    65         Assert.assertTrue(nodes.isEmpty());
    66         Assert.assertTrue(ways.isEmpty());
    67         Assert.assertTrue(relations.isEmpty());
     68        assertTrue(nodes.isEmpty());
     69        assertTrue(ways.isEmpty());
     70        assertTrue(relations.isEmpty());
    6871    }
    6972
    7073    private void checkIterator(Iterable<? extends OsmPrimitive> col, int expectedCount) {
    7174        int count = 0;
    72         Iterator<? extends OsmPrimitive> it = col.iterator();
    73         while (it.hasNext()) {
     75        for (OsmPrimitive ignored : col) {
    7476            count++;
    75             it.next();
    76         }
    77         Assert.assertEquals(expectedCount, count);
     77        }
     78        assertEquals(expectedCount, count);
    7879    }
    7980
     
    122123        Node n2 = new Node(2); n2.setCoor(new LatLon(10, 20));
    123124        Node n3 = new Node(3); n2.setCoor(new LatLon(20, 30));
    124         w2.setNodes(Arrays.asList(n1));
     125        w2.setNodes(Collections.singletonList(n1));
    125126        w3.setNodes(Arrays.asList(n1, n2, n3));
    126127
    127128        qbNodes.add(n1);
    128129        qbNodes.add(n2);
    129         Assert.assertEquals(2, qbNodes.size());
    130         Assert.assertTrue(qbNodes.contains(n1));
    131         Assert.assertTrue(qbNodes.contains(n2));
    132         Assert.assertFalse(qbNodes.contains(n3));
     130        assertEquals(2, qbNodes.size());
     131        assertTrue(qbNodes.contains(n1));
     132        assertTrue(qbNodes.contains(n2));
     133        assertFalse(qbNodes.contains(n3));
    133134        qbNodes.remove(n1);
    134         Assert.assertEquals(1, qbNodes.size());
    135         Assert.assertFalse(qbNodes.contains(n1));
    136         Assert.assertTrue(qbNodes.contains(n2));
     135        assertEquals(1, qbNodes.size());
     136        assertFalse(qbNodes.contains(n1));
     137        assertTrue(qbNodes.contains(n2));
    137138        qbNodes.remove(n2);
    138         Assert.assertEquals(0, qbNodes.size());
    139         Assert.assertFalse(qbNodes.contains(n1));
    140         Assert.assertFalse(qbNodes.contains(n2));
     139        assertEquals(0, qbNodes.size());
     140        assertFalse(qbNodes.contains(n1));
     141        assertFalse(qbNodes.contains(n2));
    141142
    142143        qbNodes.addAll(Arrays.asList(n1, n2, n3));
    143144        qbNodes.removeAll(Arrays.asList(n1, n3));
    144         Assert.assertEquals(1, qbNodes.size());
    145         Assert.assertTrue(qbNodes.contains(n2));
     145        assertEquals(1, qbNodes.size());
     146        assertTrue(qbNodes.contains(n2));
    146147
    147148        qbWays.add(w1);
    148149        qbWays.add(w2);
    149150        qbWays.add(w3);
    150         Assert.assertEquals(3, qbWays.size());
    151         Assert.assertTrue(qbWays.contains(w1));
    152         Assert.assertTrue(qbWays.contains(w2));
    153         Assert.assertTrue(qbWays.contains(w3));
     151        assertEquals(3, qbWays.size());
     152        assertTrue(qbWays.contains(w1));
     153        assertTrue(qbWays.contains(w2));
     154        assertTrue(qbWays.contains(w3));
    154155        qbWays.remove(w1);
    155         Assert.assertEquals(2, qbWays.size());
    156         Assert.assertFalse(qbWays.contains(w1));
    157         Assert.assertTrue(qbWays.contains(w2));
    158         Assert.assertTrue(qbWays.contains(w3));
     156        assertEquals(2, qbWays.size());
     157        assertFalse(qbWays.contains(w1));
     158        assertTrue(qbWays.contains(w2));
     159        assertTrue(qbWays.contains(w3));
    159160        qbWays.remove(w2);
    160         Assert.assertEquals(1, qbWays.size());
    161         Assert.assertFalse(qbWays.contains(w1));
    162         Assert.assertFalse(qbWays.contains(w2));
    163         Assert.assertTrue(qbWays.contains(w3));
     161        assertEquals(1, qbWays.size());
     162        assertFalse(qbWays.contains(w1));
     163        assertFalse(qbWays.contains(w2));
     164        assertTrue(qbWays.contains(w3));
    164165        qbWays.remove(w3);
    165         Assert.assertEquals(0, qbWays.size());
    166         Assert.assertFalse(qbWays.contains(w1));
    167         Assert.assertFalse(qbWays.contains(w2));
    168         Assert.assertFalse(qbWays.contains(w3));
     166        assertEquals(0, qbWays.size());
     167        assertFalse(qbWays.contains(w1));
     168        assertFalse(qbWays.contains(w2));
     169        assertFalse(qbWays.contains(w3));
    169170
    170171        qbWays.clear();
    171         Assert.assertEquals(0, qbWays.size());
     172        assertEquals(0, qbWays.size());
    172173        List<Way> allWays = new ArrayList<>(Arrays.asList(w1, w2, w3));
    173174        qbWays.addAll(allWays);
    174         Assert.assertEquals(3, qbWays.size());
     175        assertEquals(3, qbWays.size());
    175176        int count = 0;
    176177        for (Way w : qbWays) {
    177             Assert.assertTrue(allWays.contains(w));
     178            assertTrue(allWays.contains(w));
    178179            count++;
    179180        }
    180         Assert.assertEquals(3, count);
     181        assertEquals(3, count);
    181182        // test remove with iterator
    182183        Iterator<Way> iter = qbWays.iterator();
     
    185186            iter.remove();
    186187            count--;
    187             Assert.assertEquals(count, qbWays.size());
    188         }
    189         Assert.assertEquals(0, qbWays.size());
     188            assertEquals(count, qbWays.size());
     189        }
     190        assertEquals(0, qbWays.size());
    190191
    191192    }
     
    221222            ds.addPrimitive(w);
    222223        }
    223         Assert.assertEquals(NUM_COMPLETE_WAYS, ds.getWays().size());
    224         Assert.assertEquals(NUM_COMPLETE_WAYS * NUM_NODES_PER_WAY, ds.getNodes().size());
     224        assertEquals(NUM_COMPLETE_WAYS, ds.getWays().size());
     225        assertEquals(NUM_COMPLETE_WAYS * NUM_NODES_PER_WAY, ds.getNodes().size());
    225226
    226227        // add some incomplete nodes
     
    230231            ds.addPrimitive(n);
    231232        }
    232         Assert.assertEquals(NUM_COMPLETE_WAYS * NUM_NODES_PER_WAY + NUM_INCOMPLETE_NODES, ds.getNodes().size());
     233        assertEquals(NUM_COMPLETE_WAYS * NUM_NODES_PER_WAY + NUM_INCOMPLETE_NODES, ds.getNodes().size());
    233234        // add some incomplete ways
    234235        List<Way> incompleteWays = new ArrayList<>();
     
    239240            ds.addPrimitive(w);
    240241        }
    241         Assert.assertEquals(NUM_COMPLETE_WAYS + NUM_INCOMPLETE_WAYS, ds.getWays().size());
     242        assertEquals(NUM_COMPLETE_WAYS + NUM_INCOMPLETE_WAYS, ds.getWays().size());
    242243
    243244        BBox planet = new BBox(-180, -90, 180, 90);
    244245        // incomplete ways should not be found with search
    245         Assert.assertEquals(NUM_COMPLETE_WAYS, ds.searchWays(planet).size());
     246        assertEquals(NUM_COMPLETE_WAYS, ds.searchWays(planet).size());
    246247        // incomplete ways are only retrieved via iterator or object reference
    247248        for (Way w : incompleteWays) {
    248             Assert.assertTrue(ds.getWays().contains(w));
     249            assertTrue(ds.getWays().contains(w));
    249250        }
    250251
     
    252253        qb.addAll(ds.getWays());
    253254        int count = qb.size();
    254         Assert.assertEquals(count, ds.getWays().size());
     255        assertEquals(count, ds.getWays().size());
    255256        Iterator<Way> iter = qb.iterator();
    256257        while (iter.hasNext()) {
     
    258259            iter.remove();
    259260            count--;
    260             Assert.assertEquals(count, qb.size());
    261         }
    262         Assert.assertEquals(0, qb.size());
     261            assertEquals(count, qb.size());
     262        }
     263        assertEquals(0, qb.size());
    263264    }
    264265}
  • trunk/test/unit/org/openstreetmap/josm/data/osm/RelationTest.java

    r17275 r18690  
    77import static org.junit.jupiter.api.Assertions.assertThrows;
    88
    9 import org.junit.Assert;
    109import org.junit.jupiter.api.Test;
    1110import org.junit.jupiter.api.extension.RegisterExtension;
     
    6261        BBox bbox = new BBox(w1);
    6362        bbox.add(n3.getBBox());
    64         Assert.assertEquals(bbox, r1.getBBox());
    65         Assert.assertEquals(bbox, r2.getBBox());
     63        assertEquals(bbox, r1.getBBox());
     64        assertEquals(bbox, r2.getBBox());
    6665
    6766        n3.setCoor(new LatLon(40, 40));
    6867        bbox.add(n3.getBBox());
    69         Assert.assertEquals(bbox, r1.getBBox());
    70         Assert.assertEquals(bbox, r2.getBBox());
     68        assertEquals(bbox, r1.getBBox());
     69        assertEquals(bbox, r2.getBBox());
    7170
    7271        r1.removeMembersFor(r2);
    73         Assert.assertEquals(w1.getBBox(), r1.getBBox());
    74         Assert.assertEquals(bbox, r2.getBBox());
     72        assertEquals(w1.getBBox(), r1.getBBox());
     73        assertEquals(bbox, r2.getBBox());
    7574
    7675        w1.addNode(n3);
    77         Assert.assertEquals(w1.getBBox(), r1.getBBox());
    78         Assert.assertEquals(w1.getBBox(), r2.getBBox());
     76        assertEquals(w1.getBBox(), r1.getBBox());
     77        assertEquals(w1.getBBox(), r2.getBBox());
    7978
    8079        // create incomplete node and add it to the relation, this must not change the bbox
     
    8584        r2.addMember(new RelationMember("", n4));
    8685
    87         Assert.assertEquals(oldBBox, r2.getBBox());
     86        assertEquals(oldBBox, r2.getBBox());
    8887    }
    8988
     
    9998        r1.addMember(new RelationMember("", w1));
    10099
    101         Assert.assertEquals(new BBox(w1), r1.getBBox());
     100        assertEquals(new BBox(w1), r1.getBBox());
    102101
    103102        DataSet ds = new DataSet();
     
    107106        ds.addPrimitive(r1);
    108107
    109         Assert.assertEquals(new BBox(w1), r1.getBBox());
     108        assertEquals(new BBox(w1), r1.getBBox());
    110109
    111110        ds.removePrimitive(r1);
    112111
    113112        n1.setCoor(new LatLon(30, 40));
    114         Assert.assertEquals(new BBox(w1), r1.getBBox());
     113        assertEquals(new BBox(w1), r1.getBBox());
    115114
    116115        ds.addPrimitive(r1);
    117         Assert.assertEquals(new BBox(w1), r1.getBBox());
     116        assertEquals(new BBox(w1), r1.getBBox());
    118117    }
    119118
    120119    /**
    121120     * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/12467">Bug #12467</a>.
    122      * @throws Exception if any error occurs
    123121     */
    124122    @Test
    125     void testTicket12467() throws Exception {
     123    void testTicket12467() {
    126124        Relation r = new Relation();
    127125        r.put("type", "boundary");
     
    146144    @Test
    147145    void testCloneFromIAE() {
    148         assertThrows(IllegalArgumentException.class, () -> new Relation().cloneFrom(new Node()));
     146        final Relation relation = new Relation();
     147        final Node node = new Node();
     148        assertThrows(IllegalArgumentException.class, () -> relation.cloneFrom(node));
    149149    }
    150150
     
    154154    @Test
    155155    void testLoadIAE() {
    156         assertThrows(IllegalArgumentException.class, () -> new Relation().load(new NodeData()));
     156        final Relation relation = new Relation();
     157        final NodeData nodeData = new NodeData();
     158        assertThrows(IllegalArgumentException.class, () -> relation.load(nodeData));
    157159    }
    158160}
  • trunk/test/unit/org/openstreetmap/josm/data/osm/TagCollectionTest.java

    r18037 r18690  
    44import static org.junit.jupiter.api.Assertions.assertEquals;
    55import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertNull;
    67import static org.junit.jupiter.api.Assertions.assertTrue;
    78
     
    1718import java.util.stream.Stream;
    1819
     20import org.junit.jupiter.api.Test;
    1921import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
    20 
    21 import org.junit.jupiter.api.Test;
    2222
    2323/**
     
    8484    @Test
    8585    void testUnionOfAllPrimitivesCollectionOfQextendsTagged() {
    86         TagCollection c = TagCollection.unionOfAllPrimitives(Arrays.asList(tagA));
     86        TagCollection c = TagCollection.unionOfAllPrimitives(Collections.singletonList(tagA));
    8787        assertEquals(1, c.getTagOccurrence(tagA));
    8888
     
    9393        assertTagCounts(e, 0, 0, 0, 0);
    9494
    95         TagCollection f = TagCollection.unionOfAllPrimitives(Arrays.<Tagged>asList());
     95        TagCollection f = TagCollection.unionOfAllPrimitives(Collections.emptyList());
    9696        assertTagCounts(f, 0, 0, 0, 0);
    9797
     
    193193        TagCollection c = new TagCollection();
    194194        assertTagCounts(c, 0, 0, 0, 0);
    195         c.add(Arrays.asList(tagC));
     195        c.add(Collections.singletonList(tagC));
    196196        assertTagCounts(c, 0, 0, 1, 0);
    197197        c.add(Arrays.asList(tagA, tagC));
     
    210210        TagCollection c = new TagCollection();
    211211        assertTagCounts(c, 0, 0, 0, 0);
    212         c.add(new TagCollection(Arrays.asList(tagC)));
     212        c.add(new TagCollection(Collections.singletonList(tagC)));
    213213        assertTagCounts(c, 0, 0, 1, 0);
    214214        c.add(new TagCollection(Arrays.asList(tagA, tagC)));
     
    308308        assertTrue(c.containsAll(Arrays.asList(tagA, tagB)));
    309309        assertFalse(c.containsAll(Arrays.asList(tagA, tagC)));
    310         assertTrue(c.containsAll(Arrays.asList()));
     310        assertTrue(c.containsAll(Collections.emptyList()));
    311311        assertFalse(c.containsAll(null));
    312312    }
     
    320320        assertTrue(c.containsAllKeys(Arrays.asList("k", "k2")));
    321321        assertFalse(c.containsAllKeys(Arrays.asList("k", "k3")));
    322         assertTrue(c.containsAllKeys(Arrays.asList()));
     322        assertTrue(c.containsAllKeys(Collections.emptyList()));
    323323        assertFalse(c.containsAllKeys(null));
    324324    }
     
    394394        assertFalse(c.hasUniqueEmptyValue("k3"));
    395395
    396         TagCollection d = new TagCollection(Arrays.asList());
     396        TagCollection d = new TagCollection(Collections.emptyList());
    397397        assertFalse(d.hasUniqueEmptyValue("k"));
    398398        assertFalse(d.hasUniqueEmptyValue("k2"));
     
    453453    @Test
    454454    void testIterator() {
    455         TagCollection d = new TagCollection(Arrays.asList(tagA));
     455        TagCollection d = new TagCollection(Collections.singletonList(tagA));
    456456        Iterator<Tag> it = d.iterator();
    457457        assertTrue(it.hasNext());
     
    556556        assertEquals("b", tagged.get("k2"));
    557557        assertEquals("x", tagged.get("k3"));
    558         TagCollection d = new TagCollection(Arrays.asList(tagEmpty));
     558        TagCollection d = new TagCollection(Collections.singletonList(tagEmpty));
    559559        d.applyTo(tagged);
    560         assertEquals(null, tagged.get("k"));
     560        assertNull(tagged.get("k"));
    561561    }
    562562
     
    591591        assertEquals("v", tagged.get("k"));
    592592        assertEquals("b", tagged.get("k2"));
    593         assertEquals(null, tagged.get("k3"));
     593        assertNull(tagged.get("k3"));
    594594    }
    595595
     
    609609        assertEquals("v", tagged2.get("k"));
    610610        assertEquals("b", tagged2.get("k2"));
    611         assertEquals(null, tagged2.get("k3"));
     611        assertNull(tagged2.get("k3"));
    612612    }
    613613
     
    671671    @Test
    672672    void testGetJoinedValues() {
    673         TagCollection c = new TagCollection(Arrays.asList(new Tag("k", "a")));
     673        TagCollection c = new TagCollection(Collections.singletonList(new Tag("k", "a")));
    674674        assertEquals("a", c.getJoinedValues("k"));
    675675        TagCollection d = new TagCollection(Arrays.asList(new Tag("k", "a"), new Tag("k", "b")));
  • trunk/test/unit/org/openstreetmap/josm/data/osm/WayDataTest.java

    r17275 r18690  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.data.osm;
     3
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    35
    46import java.io.ByteArrayInputStream;
     
    810import java.util.Arrays;
    911
    10 import org.junit.Assert;
    1112import org.junit.jupiter.api.Test;
    1213
     
    3132            }
    3233        }
    33         Assert.assertEquals(data.toString(), readData.toString());
     34        assertEquals(data.toString(), readData.toString());
    3435    }
    3536}
  • trunk/test/unit/org/openstreetmap/josm/data/osm/WaySegmentTest.java

    r17896 r18690  
    22package org.openstreetmap.josm.data.osm;
    33
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertThrows;
     6
    47import java.util.Arrays;
    58
    6 import org.junit.Assert;
    79import org.junit.jupiter.api.extension.RegisterExtension;
    810import org.junit.jupiter.api.Test;
     
    2527
    2628    @Test
    27     void testForNodePair() throws Exception {
     29    void testForNodePair() {
    2830        final DataSet ds = new DataSet();
    2931        final Node n1 = new Node(LatLon.ZERO);
     
    4244        w.addNode(n4);
    4345        w.addNode(n1);
    44         Assert.assertEquals(WaySegment.forNodePair(w, n1, n2).getLowerIndex(), 0);
    45         Assert.assertEquals(WaySegment.forNodePair(w, n1, n3).getLowerIndex(), 2);
    46         Assert.assertEquals(WaySegment.forNodePair(w, n1, n4).getLowerIndex(), 4);
    47         Assert.assertEquals(WaySegment.forNodePair(w, n4, n1).getLowerIndex(), 5);
    48         try {
    49             Assert.assertEquals(WaySegment.forNodePair(w, n3, n4).getLowerIndex(), 5);
    50             throw new IllegalStateException("Expecting IllegalArgumentException");
    51         } catch (IllegalArgumentException expected) {
    52             System.out.println("Expected exception: " + expected.getMessage());
    53         }
     46        assertEquals(WaySegment.forNodePair(w, n1, n2).getLowerIndex(), 0);
     47        assertEquals(WaySegment.forNodePair(w, n1, n3).getLowerIndex(), 2);
     48        assertEquals(WaySegment.forNodePair(w, n1, n4).getLowerIndex(), 4);
     49        assertEquals(WaySegment.forNodePair(w, n4, n1).getLowerIndex(), 5);
     50        IllegalArgumentException iae = assertThrows(IllegalArgumentException.class, () -> WaySegment.forNodePair(w, n3, n4));
     51        assertEquals("Node pair is not part of way!", iae.getMessage());
    5452    }
    5553}
  • trunk/test/unit/org/openstreetmap/josm/data/osm/history/HistoryWayTest.java

    r17838 r18690  
    33
    44import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertThrows;
    56import static org.junit.jupiter.api.Assertions.assertTrue;
    6 import static org.junit.jupiter.api.Assertions.fail;
    77
    88import java.time.Instant;
     
    1111import java.util.Map;
    1212
     13import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     14import org.junit.jupiter.api.Test;
    1315import org.junit.jupiter.api.extension.RegisterExtension;
    14 import org.junit.jupiter.api.Test;
    1516import org.openstreetmap.josm.data.osm.DefaultNameFormatter;
    1617import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
    1718import org.openstreetmap.josm.data.osm.User;
    1819import org.openstreetmap.josm.testutils.JOSMTestRules;
    19 import org.openstreetmap.josm.tools.Logging;
    20 
    21 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    2220
    2321/**
     
    7876        assertEquals(1, way.getNumNodes());
    7977        assertEquals(1, way.getNodeId(0));
    80         try {
    81             way.getNodeId(1);
    82             fail("expected expection of type " + IndexOutOfBoundsException.class.toString());
    83         } catch (IndexOutOfBoundsException e) {
    84             // OK
    85             Logging.trace(e);
    86         }
     78        assertThrows(IndexOutOfBoundsException.class, () -> way.getNodeId(1));
    8779
    8880        way.addNode(5);
  • trunk/test/unit/org/openstreetmap/josm/data/osm/search/SearchCompilerTest.java

    r18496 r18690  
    1919import java.util.Set;
    2020
    21 import org.junit.Assert;
    2221import org.junit.jupiter.api.Test;
    2322import org.junit.jupiter.api.Timeout;
     
    430429    /**
    431430     * Compiles "foo type bar" and tests the parse error message
    432      * @throws SearchParseError always
    433      */
    434     @Test
    435     void testFooTypeBar() throws SearchParseError {
     431     */
     432    @Test
     433    void testFooTypeBar() {
    436434        Exception e = assertThrows(SearchParseError.class, () -> SearchCompiler.compile("foo type bar"));
    437435        assertEquals("<html>Expecting <code>:</code> after <i>type</i></html>", e.getMessage());
     
    754752        TestUtils.assumeWorkingEqualsVerifier();
    755753        Set<Class<? extends Match>> matchers = TestUtils.getJosmSubtypes(Match.class);
    756         Assert.assertTrue(matchers.size() >= 10); // if it finds less than 10 classes, something is broken
     754        assertTrue(matchers.size() >= 10); // if it finds less than 10 classes, something is broken
    757755        for (Class<?> c : matchers) {
    758756            Logging.debug(c.toString());
  • trunk/test/unit/org/openstreetmap/josm/data/preferences/StrokePropertyTest.java

    r18037 r18690  
    44import static org.junit.jupiter.api.Assertions.assertArrayEquals;
    55import static org.junit.jupiter.api.Assertions.assertEquals;
     6import static org.junit.jupiter.api.Assertions.assertNull;
    67
    78import java.awt.BasicStroke;
    89
     10import org.junit.jupiter.api.Test;
    911import org.openstreetmap.josm.spi.preferences.Config;
    1012import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
    11 
    12 import org.junit.jupiter.api.Test;
    1313
    1414/**
     
    3030        assertWide(bs);
    3131        assertEquals(11, bs.getLineWidth(), 1e-10);
    32         assertEquals(null, bs.getDashArray());
     32        assertNull(bs.getDashArray());
    3333
    3434        Config.getPref().put("x", ".5");
     
    3636        assertThin(bs);
    3737        assertEquals(.5, bs.getLineWidth(), 1e-10);
    38         assertEquals(null, bs.getDashArray());
     38        assertNull(bs.getDashArray());
    3939
    4040        Config.getPref().put("x", "2 1");
     
    5454        assertThin(bs);
    5555        assertEquals(1, bs.getLineWidth(), 1e-10);
    56         assertEquals(null, bs.getDashArray());
     56        assertNull(bs.getDashArray());
    5757
    5858        // ignore dashes
     
    6161        assertWide(bs);
    6262        assertEquals(11, bs.getLineWidth(), 1e-10);
    63         assertEquals(null, bs.getDashArray());
     63        assertNull(bs.getDashArray());
    6464    }
    6565
     
    7474        assertWide(bs);
    7575        assertEquals(12, bs.getLineWidth(), 1e-10);
    76         assertEquals(null, bs.getDashArray());
     76        assertNull(bs.getDashArray());
    7777
    7878        property.put(new BasicStroke(2, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1, new float[] {0.1f, 1, 10}, 0));
  • trunk/test/unit/org/openstreetmap/josm/data/projection/EllipsoidTest.java

    r18144 r18690  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.data.projection;
     3
     4import static org.junit.jupiter.api.Assertions.fail;
    35
    46import java.security.SecureRandom;
    57import java.util.Random;
    68
    7 import org.junit.Assert;
    89import org.junit.jupiter.api.Test;
    910import org.openstreetmap.josm.data.coor.LatLon;
     
    3738                    String error = String.format("point: %s iterations: %s current: %s errorLat: %s errorLon %s",
    3839                            new LatLon(lat, lon), i, ll, Math.abs(lat - ll.lat()), Math.abs(lon - ll.lon()));
    39                     System.err.println(error);
    40                     Assert.fail();
     40                    fail(error);
    4141                }
    4242            }
  • trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRefTest.java

    r18027 r18690  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.data.projection;
     3
     4import static org.junit.jupiter.api.Assertions.fail;
    35
    46import java.io.BufferedReader;
     
    3436import java.util.regex.Pattern;
    3537
    36 import org.junit.Assert;
    3738import org.junit.jupiter.api.Test;
    3839import org.junit.jupiter.api.extension.RegisterExtension;
     
    133134                    Matcher m = projPattern.matcher(line);
    134135                    if (!m.matches()) {
    135                         Assert.fail("unable to parse line: " + line);
     136                        fail("unable to parse line: " + line);
    136137                    }
    137138                    String code = m.group(1);
     
    383384        refs.stream().map(ref -> ref.code).forEach(allCodes::remove);
    384385        if (!allCodes.isEmpty()) {
    385             Assert.fail("no reference data for following projections: "+allCodes);
     386            fail("no reference data for following projections: "+allCodes);
    386387        }
    387388
     
    389390            String def0 = Projections.getInit(ref.code);
    390391            if (def0 == null) {
    391                 Assert.fail("unknown code: "+ref.code);
     392                fail("unknown code: "+ref.code);
    392393            }
    393394            if (!ref.def.equals(def0)) {
     
    411412                                "        expected: eastnorth(%s,%s),%n" +
    412413                                "        but got:  eastnorth(%s,%s)!%n",
    413                                 proj.toString(), proj.toCode(), ll.lat(), ll.lon(), enRef.east(), enRef.north(), en.east(), en.north());
     414                                proj, proj.toCode(), ll.lat(), ll.lon(), enRef.east(), enRef.north(), en.east(), en.north());
    414415                        failures.add(errorEN);
    415416                        failingProjs.computeIfAbsent(proj.proj.getProj4Id(), x -> new TreeSet<>()).add(ref.code);
     
    419420        });
    420421        if (!failures.isEmpty()) {
    421             System.err.println(failures.toString());
     422            System.err.println(failures);
    422423            throw new AssertionError("Failing:\n" +
    423424                    failingProjs.keySet().size() + " projections: " + failingProjs.keySet() + "\n" +
  • trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java

    r18100 r18690  
    161161        for (String code : Projections.getAllProjectionCodes()) {
    162162            if (!dataCodes.contains(code)) {
    163                  fail.append("Did not find projection "+code+" in test data!\n");
     163                 fail.append("Did not find projection ").append(code).append(" in test data!\n");
    164164             }
    165165        }
     
    169169            Projection proj = Projections.getProjectionByCode(data.code);
    170170            if (proj == null) {
    171                 fail.append("Projection "+data.code+" from test data was not found!\n");
     171                fail.append("Projection ").append(data.code).append(" from test data was not found!\n");
    172172                continue;
    173173            }
     
    178178                        "        expected: eastnorth(%s,%s),%n" +
    179179                        "        but got:  eastnorth(%s,%s)!%n",
    180                         proj.toString(), data.code, data.ll.lat(), data.ll.lon(), data.en.east(), data.en.north(), en.east(), en.north());
     180                        proj, data.code, data.ll.lat(), data.ll.lon(), data.en.east(), data.en.north(), en.east(), en.north());
    181181                fail.append(error);
    182182            }
     
    185185                        "        expected: latlon(%s,%s),%n" +
    186186                        "        but got:  latlon(%s,%s)!%n",
    187                         proj.toString(), data.code, data.en.east(), data.en.north(), data.ll2.lat(), data.ll2.lon(), ll2.lat(), ll2.lon());
     187                        proj, data.code, data.en.east(), data.en.north(), data.ll2.lat(), data.ll2.lon(), ll2.lat(), ll2.lon());
    188188                fail.append(error);
    189189            }
     
    191191
    192192        if (fail.length() > 0) {
    193             System.err.println(fail.toString());
     193            System.err.println(fail);
    194194            throw new AssertionError(fail.toString());
    195195        }
  • trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionTest.java

    r18494 r18690  
    33
    44import static org.junit.jupiter.api.Assertions.assertTrue;
     5import static org.junit.jupiter.api.Assertions.fail;
    56
    67import java.security.SecureRandom;
     
    1011import java.util.Random;
    1112
    12 import org.junit.Assert;
    1313import org.junit.jupiter.api.Test;
    1414import org.openstreetmap.josm.data.Bounds;
     
    4040
    4141        for (int i = 0; i <= 3; ++i) {
    42             testProjection(Projections.getProjectionByCode("EPSG:"+Integer.toString(27561+i))); // Lambert 4 Zones France
     42            testProjection(Projections.getProjectionByCode("EPSG:"+ (27561 + i))); // Lambert 4 Zones France
    4343        }
    4444
    4545        for (int i = 0; i <= 4; ++i) {
    46             testProjection(Projections.getProjectionByCode("EPSG:"+Integer.toString(2176+i))); // PUWG Poland
     46            testProjection(Projections.getProjectionByCode("EPSG:"+ (2176 + i))); // PUWG Poland
    4747        }
    4848
     
    5050
    5151        for (int i = 0; i <= 60; ++i) {
    52             testProjection(Projections.getProjectionByCode("EPSG:"+Integer.toString(32601+i))); // UTM North
    53             testProjection(Projections.getProjectionByCode("EPSG:"+Integer.toString(32701+i))); // UTM South
     52            testProjection(Projections.getProjectionByCode("EPSG:"+ (32601 + i))); // UTM North
     53            testProjection(Projections.getProjectionByCode("EPSG:"+ (32701 + i))); // UTM South
    5454        }
    5555
     
    5959
    6060        for (int i = 0; i <= 8; ++i) {
    61             testProjection(Projections.getProjectionByCode("EPSG:"+Integer.toString(3942+i))); // Lambert CC9 Zones France
     61            testProjection(Projections.getProjectionByCode("EPSG:"+ (3942 + i))); // Lambert CC9 Zones France
    6262        }
    6363
    6464        for (int i = 0; i <= 17; ++i) {
    65             testProjection(Projections.getProjectionByCode("EPSG:"+Integer.toString(102421+i))); // WGS_1984_ARC_System Zones
     65            testProjection(Projections.getProjectionByCode("EPSG:"+ (102421 + i))); // WGS_1984_ARC_System Zones
    6666        }
    6767
     
    7070
    7171        if (error) {
    72             System.err.println(text);
    73             Assert.fail();
     72            fail(text);
    7473        }
    7574    }
     
    8079            Bounds b = p.getWorldBoundsLatLon();
    8180
    82             text += String.format("*** %s %s%n", p.toString(), p.toCode());
     81            text += String.format("*** %s %s%n", p, p.toCode());
    8382            for (int num = 0; num < 1000; ++num) {
    8483
     
    148147
    149148        if (error2) {
    150             System.err.println(text2);
    151             Assert.fail();
     149            fail(text2);
    152150        }
    153151        assertTrue(projIds.isEmpty(), "missing test: "+projIds);
  • trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionsTest.java

    r18030 r18690  
    22package org.openstreetmap.josm.data.projection;
    33
    4 import static org.junit.Assert.assertNull;
     4import static org.junit.jupiter.api.Assertions.assertNull;
    55
    66import org.junit.jupiter.api.Test;
  • trunk/test/unit/org/openstreetmap/josm/data/validation/routines/DomainValidatorTest.java

    r17275 r18690  
    1717package org.openstreetmap.josm.data.validation.routines;
    1818
    19 import static org.junit.Assert.assertEquals;
    20 import static org.junit.Assert.assertFalse;
    21 import static org.junit.Assert.assertNotNull;
    22 import static org.junit.Assert.assertNull;
    23 import static org.junit.Assert.assertTrue;
     19import static org.junit.jupiter.api.Assertions.assertEquals;
     20import static org.junit.jupiter.api.Assertions.assertFalse;
     21import static org.junit.jupiter.api.Assertions.assertNotNull;
     22import static org.junit.jupiter.api.Assertions.assertNull;
     23import static org.junit.jupiter.api.Assertions.assertSame;
     24import static org.junit.jupiter.api.Assertions.assertThrows;
     25import static org.junit.jupiter.api.Assertions.assertTrue;
    2426import static org.junit.jupiter.api.Assertions.fail;
    2527
     
    3032import org.junit.jupiter.api.BeforeEach;
    3133import org.junit.jupiter.api.Test;
     34import org.junit.jupiter.params.ParameterizedTest;
     35import org.junit.jupiter.params.provider.EnumSource;
     36import org.junit.jupiter.params.provider.ValueSource;
    3237import org.openstreetmap.josm.data.validation.routines.DomainValidator.ArrayType;
    3338import org.openstreetmap.josm.tools.Logging;
     
    5661    @Test
    5762    void testValidDomains() {
    58         assertTrue("apache.org should validate", validator.isValid("apache.org"));
    59         assertTrue("www.google.com should validate", validator.isValid("www.google.com"));
    60 
    61         assertTrue("test-domain.com should validate", validator.isValid("test-domain.com"));
    62         assertTrue("test---domain.com should validate", validator.isValid("test---domain.com"));
    63         assertTrue("test-d-o-m-ain.com should validate", validator.isValid("test-d-o-m-ain.com"));
    64         assertTrue("two-letter domain label should validate", validator.isValid("as.uk"));
    65 
    66         assertTrue("case-insensitive ApAchE.Org should validate", validator.isValid("ApAchE.Org"));
    67 
    68         assertTrue("single-character domain label should validate", validator.isValid("z.com"));
    69 
    70         assertTrue("i.have.an-example.domain.name should validate", validator.isValid("i.have.an-example.domain.name"));
     63        assertTrue(validator.isValid("apache.org"), "apache.org should validate");
     64        assertTrue(validator.isValid("www.google.com"), "www.google.com should validate");
     65
     66        assertTrue(validator.isValid("test-domain.com"), "test-domain.com should validate");
     67        assertTrue(validator.isValid("test---domain.com"), "test---domain.com should validate");
     68        assertTrue(validator.isValid("test-d-o-m-ain.com"), "test-d-o-m-ain.com should validate");
     69        assertTrue(validator.isValid("as.uk"), "two-letter domain label should validate");
     70
     71        assertTrue(validator.isValid("ApAchE.Org"), "case-insensitive ApAchE.Org should validate");
     72
     73        assertTrue(validator.isValid("z.com"), "single-character domain label should validate");
     74
     75        assertTrue(validator.isValid("i.have.an-example.domain.name"), "i.have.an-example.domain.name should validate");
    7176    }
    7277
     
    7681    @Test
    7782    void testInvalidDomains() {
    78         assertFalse("bare TLD .org shouldn't validate", validator.isValid(".org"));
    79         assertFalse("domain name with spaces shouldn't validate", validator.isValid(" apache.org "));
    80         assertFalse("domain name containing spaces shouldn't validate", validator.isValid("apa che.org"));
    81         assertFalse("domain name starting with dash shouldn't validate", validator.isValid("-testdomain.name"));
    82         assertFalse("domain name ending with dash shouldn't validate", validator.isValid("testdomain-.name"));
    83         assertFalse("domain name starting with multiple dashes shouldn't validate", validator.isValid("---c.com"));
    84         assertFalse("domain name ending with multiple dashes shouldn't validate", validator.isValid("c--.com"));
    85         assertFalse("domain name with invalid TLD shouldn't validate", validator.isValid("apache.rog"));
    86 
    87         assertFalse("URL shouldn't validate", validator.isValid("http://www.apache.org"));
    88         assertFalse("Empty string shouldn't validate as domain name", validator.isValid(" "));
    89         assertFalse("Null shouldn't validate as domain name", validator.isValid(null));
     83        assertFalse(validator.isValid(".org"), "bare TLD .org shouldn't validate");
     84        assertFalse(validator.isValid(" apache.org "), "domain name with spaces shouldn't validate");
     85        assertFalse(validator.isValid("apa che.org"), "domain name containing spaces shouldn't validate");
     86        assertFalse(validator.isValid("-testdomain.name"), "domain name starting with dash shouldn't validate");
     87        assertFalse(validator.isValid("testdomain-.name"), "domain name ending with dash shouldn't validate");
     88        assertFalse(validator.isValid("---c.com"), "domain name starting with multiple dashes shouldn't validate");
     89        assertFalse(validator.isValid("c--.com"), "domain name ending with multiple dashes shouldn't validate");
     90        assertFalse(validator.isValid("apache.rog"), "domain name with invalid TLD shouldn't validate");
     91
     92        assertFalse(validator.isValid("http://www.apache.org"), "URL shouldn't validate");
     93        assertFalse(validator.isValid(" "), "Empty string shouldn't validate as domain name");
     94        assertFalse(validator.isValid(null), "Null shouldn't validate as domain name");
    9095    }
    9196
     
    96101    void testTopLevelDomains() {
    97102        // infrastructure TLDs
    98         assertTrue(".arpa should validate as iTLD", validator.isValidInfrastructureTld(".arpa"));
    99         assertFalse(".com shouldn't validate as iTLD", validator.isValidInfrastructureTld(".com"));
     103        assertTrue(validator.isValidInfrastructureTld(".arpa"), ".arpa should validate as iTLD");
     104        assertFalse(validator.isValidInfrastructureTld(".com"), ".com shouldn't validate as iTLD");
    100105
    101106        // generic TLDs
    102         assertTrue(".name should validate as gTLD", validator.isValidGenericTld(".name"));
    103         assertFalse(".us shouldn't validate as gTLD", validator.isValidGenericTld(".us"));
     107        assertTrue(validator.isValidGenericTld(".name"), ".name should validate as gTLD");
     108        assertFalse(validator.isValidGenericTld(".us"), ".us shouldn't validate as gTLD");
    104109
    105110        // country code TLDs
    106         assertTrue(".uk should validate as ccTLD", validator.isValidCountryCodeTld(".uk"));
    107         assertFalse(".org shouldn't validate as ccTLD", validator.isValidCountryCodeTld(".org"));
     111        assertTrue(validator.isValidCountryCodeTld(".uk"), ".uk should validate as ccTLD");
     112        assertFalse(validator.isValidCountryCodeTld(".org"), ".org shouldn't validate as ccTLD");
    108113
    109114        // case-insensitive
    110         assertTrue(".COM should validate as TLD", validator.isValidTld(".COM"));
    111         assertTrue(".BiZ should validate as TLD", validator.isValidTld(".BiZ"));
     115        assertTrue(validator.isValidTld(".COM"), ".COM should validate as TLD");
     116        assertTrue(validator.isValidTld(".BiZ"), ".BiZ should validate as TLD");
    112117
    113118        // corner cases
    114         assertFalse("invalid TLD shouldn't validate", validator.isValid(".nope")); // TODO this is not guaranteed invalid forever
    115         assertFalse("empty string shouldn't validate as TLD", validator.isValid(""));
    116         assertFalse("null shouldn't validate as TLD", validator.isValid(null));
     119        assertFalse(validator.isValid(".nope"), "invalid TLD shouldn't validate"); // TODO this is not guaranteed invalid forever
     120        assertFalse(validator.isValid(""), "empty string shouldn't validate as TLD");
     121        assertFalse(validator.isValid(null), "null shouldn't validate as TLD");
    117122    }
    118123
     
    125130       DomainValidator allowLocal = DomainValidator.getInstance(true);
    126131
    127        // Default is false, and should use singletons
    128        assertEquals(noLocal, validator);
     132       // Should use singletons
     133       assertSame(noLocal, validator);
    129134
    130135       // Default won't allow local
    131        assertFalse("localhost.localdomain should validate", noLocal.isValid("localhost.localdomain"));
    132        assertFalse("localhost should validate", noLocal.isValid("localhost"));
     136       assertFalse(noLocal.isValid("localhost.localdomain"), "localhost.localdomain should validate");
     137       assertFalse(noLocal.isValid("localhost"), "localhost should validate");
    133138
    134139       // But it may be requested
    135        assertTrue("localhost.localdomain should validate", allowLocal.isValid("localhost.localdomain"));
    136        assertTrue("localhost should validate", allowLocal.isValid("localhost"));
    137        assertTrue("hostname should validate", allowLocal.isValid("hostname"));
    138        assertTrue("machinename should validate", allowLocal.isValid("machinename"));
     140       assertTrue(allowLocal.isValid("localhost.localdomain"), "localhost.localdomain should validate");
     141       assertTrue(allowLocal.isValid("localhost"), "localhost should validate");
     142       assertTrue(allowLocal.isValid("hostname"), "hostname should validate");
     143       assertTrue(allowLocal.isValid("machinename"), "machinename should validate");
    139144
    140145       // Check the localhost one with a few others
    141        assertTrue("apache.org should validate", allowLocal.isValid("apache.org"));
    142        assertFalse("domain name with spaces shouldn't validate", allowLocal.isValid(" apache.org "));
     146       assertTrue(allowLocal.isValid("apache.org"), "apache.org should validate");
     147       assertFalse(allowLocal.isValid(" apache.org "), "domain name with spaces shouldn't validate");
    143148    }
    144149
     
    148153    @Test
    149154    void testIDN() {
    150        assertTrue("b\u00fccher.ch in IDN should validate", validator.isValid("www.xn--bcher-kva.ch"));
    151     }
    152 
    153     /**
    154      * Test IDN with Java >= 6.
    155      */
    156     @Test
    157     void testIDNJava6OrLater() {
    158         String version = System.getProperty("java.version");
    159         if (version.compareTo("1.6") < 0) {
    160             System.out.println("Cannot run Unicode IDN tests");
    161             return; // Cannot run the test
    162         } // xn--d1abbgf6aiiy.xn--p1ai http://президент.рф
    163        assertTrue("b\u00fccher.ch should validate", validator.isValid("www.b\u00fccher.ch"));
    164        assertTrue("xn--d1abbgf6aiiy.xn--p1ai should validate", validator.isValid("xn--d1abbgf6aiiy.xn--p1ai"));
    165        assertTrue("президент.рф should validate", validator.isValid("президент.рф"));
    166        assertFalse("www.\uFFFD.ch FFFD should fail", validator.isValid("www.\uFFFD.ch"));
     155       assertTrue(validator.isValid("www.xn--bcher-kva.ch"), "b\u00fccher.ch in IDN should validate");
     156       assertTrue(validator.isValid("www.b\u00fccher.ch"), "b\u00fccher.ch should validate");
     157       // xn--d1abbgf6aiiy.xn--p1ai http://президент.рф
     158       assertTrue(validator.isValid("xn--d1abbgf6aiiy.xn--p1ai"), "xn--d1abbgf6aiiy.xn--p1ai should validate");
     159       assertTrue(validator.isValid("президент.рф"), "президент.рф should validate");
     160       assertFalse(validator.isValid("www.\uFFFD.ch"), "www.\uFFFD.ch FFFD should fail");
    167161    }
    168162
     
    172166    @Test
    173167    void testRFC2396domainlabel() { // use fixed valid TLD
    174         assertTrue("a.ch should validate", validator.isValid("a.ch"));
    175         assertTrue("9.ch should validate", validator.isValid("9.ch"));
    176         assertTrue("az.ch should validate", validator.isValid("az.ch"));
    177         assertTrue("09.ch should validate", validator.isValid("09.ch"));
    178         assertTrue("9-1.ch should validate", validator.isValid("9-1.ch"));
    179         assertFalse("91-.ch should not validate", validator.isValid("91-.ch"));
    180         assertFalse("-.ch should not validate", validator.isValid("-.ch"));
     168        assertTrue(validator.isValid("a.ch"), "a.ch should validate");
     169        assertTrue(validator.isValid("9.ch"), "9.ch should validate");
     170        assertTrue(validator.isValid("az.ch"), "az.ch should validate");
     171        assertTrue(validator.isValid("09.ch"), "09.ch should validate");
     172        assertTrue(validator.isValid("9-1.ch"), "9-1.ch should validate");
     173        assertFalse(validator.isValid("91-.ch"), "91-.ch should not validate");
     174        assertFalse(validator.isValid("-.ch"), "-.ch should not validate");
    181175    }
    182176
     
    187181    void testRFC2396toplabel() {
    188182        // These tests use non-existent TLDs so currently need to use a package protected method
    189         assertTrue("a.c (alpha) should validate", validator.isValidDomainSyntax("a.c"));
    190         assertTrue("a.cc (alpha alpha) should validate", validator.isValidDomainSyntax("a.cc"));
    191         assertTrue("a.c9 (alpha alphanum) should validate", validator.isValidDomainSyntax("a.c9"));
    192         assertTrue("a.c-9 (alpha - alphanum) should validate", validator.isValidDomainSyntax("a.c-9"));
    193         assertTrue("a.c-z (alpha - alpha) should validate", validator.isValidDomainSyntax("a.c-z"));
    194 
    195         assertFalse("a.9c (alphanum alpha) should fail", validator.isValidDomainSyntax("a.9c"));
    196         assertFalse("a.c- (alpha -) should fail", validator.isValidDomainSyntax("a.c-"));
    197         assertFalse("a.- (-) should fail", validator.isValidDomainSyntax("a.-"));
    198         assertFalse("a.-9 (- alphanum) should fail", validator.isValidDomainSyntax("a.-9"));
     183        assertTrue(validator.isValidDomainSyntax("a.c"), "a.c (alpha) should validate");
     184        assertTrue(validator.isValidDomainSyntax("a.cc"), "a.cc (alpha alpha) should validate");
     185        assertTrue(validator.isValidDomainSyntax("a.c9"), "a.c9 (alpha alphanum) should validate");
     186        assertTrue(validator.isValidDomainSyntax("a.c-9"), "a.c-9 (alpha - alphanum) should validate");
     187        assertTrue(validator.isValidDomainSyntax("a.c-z"), "a.c-z (alpha - alpha) should validate");
     188
     189        assertFalse(validator.isValidDomainSyntax("a.9c"), "a.9c (alphanum alpha) should fail");
     190        assertFalse(validator.isValidDomainSyntax("a.c-"), "a.c- (alpha -) should fail");
     191        assertFalse(validator.isValidDomainSyntax("a.-"), "a.- (-) should fail");
     192        assertFalse(validator.isValidDomainSyntax("a.-9"), "a.-9 (- alphanum) should fail");
    199193    }
    200194
     
    204198    @Test
    205199    void testDomainNoDots() {
    206         assertTrue("a (alpha) should validate", validator.isValidDomainSyntax("a"));
    207         assertTrue("9 (alphanum) should validate", validator.isValidDomainSyntax("9"));
    208         assertTrue("c-z (alpha - alpha) should validate", validator.isValidDomainSyntax("c-z"));
    209 
    210         assertFalse("c- (alpha -) should fail", validator.isValidDomainSyntax("c-"));
    211         assertFalse("-c (- alpha) should fail", validator.isValidDomainSyntax("-c"));
    212         assertFalse("- (-) should fail", validator.isValidDomainSyntax("-"));
     200        assertTrue(validator.isValidDomainSyntax("a"), "a (alpha) should validate");
     201        assertTrue(validator.isValidDomainSyntax("9"), "9 (alphanum) should validate");
     202        assertTrue(validator.isValidDomainSyntax("c-z"), "c-z (alpha - alpha) should validate");
     203
     204        assertFalse(validator.isValidDomainSyntax("c-"), "c- (alpha -) should fail");
     205        assertFalse(validator.isValidDomainSyntax("-c"), "-c (- alpha) should fail");
     206        assertFalse(validator.isValidDomainSyntax("-"), "- (-) should fail");
    213207    }
    214208
     
    218212    @Test
    219213    void testValidator297() {
    220         assertTrue("xn--d1abbgf6aiiy.xn--p1ai should validate", validator.isValid("xn--d1abbgf6aiiy.xn--p1ai")); // This uses a valid TLD
     214        assertTrue(validator.isValid("xn--d1abbgf6aiiy.xn--p1ai"), "xn--d1abbgf6aiiy.xn--p1ai should validate"); // This uses a valid TLD
    221215     }
    222216
     
    230224        assertEquals(63, longString.length()); // 26 * 2 + 11
    231225
    232         assertTrue("63 chars label should validate", validator.isValidDomainSyntax(longString+".com"));
    233         assertFalse("64 chars label should fail", validator.isValidDomainSyntax(longString+"x.com"));
    234 
    235         assertTrue("63 chars TLD should validate", validator.isValidDomainSyntax("test."+longString));
    236         assertFalse("64 chars TLD should fail", validator.isValidDomainSyntax("test.x"+longString));
     226        assertTrue(validator.isValidDomainSyntax(longString+".com"), "63 chars label should validate");
     227        assertFalse(validator.isValidDomainSyntax(longString+"x.com"), "64 chars label should fail");
     228
     229        assertTrue(validator.isValidDomainSyntax("test."+longString), "63 chars TLD should validate");
     230        assertFalse(validator.isValidDomainSyntax("test.x"+longString), "64 chars TLD should fail");
    237231
    238232        final String longDomain =
     
    242236                + "." + longString.substring(0, 61);
    243237        assertEquals(253, longDomain.length());
    244         assertTrue("253 chars domain should validate", validator.isValidDomainSyntax(longDomain));
    245         assertFalse("254 chars domain should fail", validator.isValidDomainSyntax(longDomain+"x"));
     238        assertTrue(validator.isValidDomainSyntax(longDomain), "253 chars domain should validate");
     239        assertFalse(validator.isValidDomainSyntax(longDomain+"x"), "254 chars domain should fail");
    246240    }
    247241
     
    288282     * @throws Exception if an error occurs
    289283     */
    290     @Test
    291     void test_INFRASTRUCTURE_TLDS_sortedAndLowerCase() throws Exception {
    292         final boolean sorted = isSortedLowerCase("INFRASTRUCTURE_TLDS");
    293         assertTrue(sorted);
    294     }
    295 
    296     /**
    297      * Check array is sorted and is lower-case
    298      * @throws Exception if an error occurs
    299      */
    300     @Test
    301     void test_COUNTRY_CODE_TLDS_sortedAndLowerCase() throws Exception {
    302         final boolean sorted = isSortedLowerCase("COUNTRY_CODE_TLDS");
    303         assertTrue(sorted);
    304     }
    305 
    306     /**
    307      * Check array is sorted and is lower-case
    308      * @throws Exception if an error occurs
    309      */
    310     @Test
    311     void test_GENERIC_TLDS_sortedAndLowerCase() throws Exception {
    312         final boolean sorted = isSortedLowerCase("GENERIC_TLDS");
    313         assertTrue(sorted);
    314     }
    315 
    316     /**
    317      * Check array is sorted and is lower-case
    318      * @throws Exception if an error occurs
    319      */
    320     @Test
    321     void test_LOCAL_TLDS_sortedAndLowerCase() throws Exception {
    322         final boolean sorted = isSortedLowerCase("LOCAL_TLDS");
     284    @ParameterizedTest
     285    @ValueSource(strings = {"COUNTRY_CODE_TLDS", "GENERIC_TLDS", "INFRASTRUCTURE_TLDS", "LOCAL_TLDS"})
     286    void testArraySortedAndLowerCase(String arrayName) throws Exception {
     287        final boolean sorted = isSortedLowerCase(arrayName);
    323288        assertTrue(sorted);
    324289    }
     
    335300     * Test update base arrays
    336301     */
    337     @Test
    338     void testUpdateBaseArrays() {
    339         try {
    340             DomainValidator.updateTLDOverride(ArrayType.COUNTRY_CODE_RO, new String[]{"com"});
    341             fail("Expected IllegalArgumentException");
    342         } catch (IllegalArgumentException iae) {
    343             // expected
    344             Logging.debug(iae.getMessage());
    345         }
    346         try {
    347             DomainValidator.updateTLDOverride(ArrayType.GENERIC_RO, new String[]{"com"});
    348             fail("Expected IllegalArgumentException");
    349         } catch (IllegalArgumentException iae) {
    350             // expected
    351             Logging.debug(iae.getMessage());
    352         }
    353         try {
    354             DomainValidator.updateTLDOverride(ArrayType.INFRASTRUCTURE_RO, new String[]{"com"});
    355             fail("Expected IllegalArgumentException");
    356         } catch (IllegalArgumentException iae) {
    357             // expected
    358             Logging.debug(iae.getMessage());
    359         }
    360         try {
    361             DomainValidator.updateTLDOverride(ArrayType.LOCAL_RO, new String[]{"com"});
    362             fail("Expected IllegalArgumentException");
    363         } catch (IllegalArgumentException iae) {
    364             // expected
    365             Logging.debug(iae.getMessage());
    366         }
     302    @ParameterizedTest
     303    @EnumSource(value = ArrayType.class, mode = EnumSource.Mode.MATCH_ALL, names = "^.*RO$")
     304    void testUpdateBaseArrays(ArrayType type) {
     305        Logging.debug(assertThrows(IllegalArgumentException.class, () -> DomainValidator.updateTLDOverride(type, "com")));
    367306    }
    368307
     
    370309     * Test get array.
    371310     */
    372     @Test
    373     void testGetArray() {
    374         assertNotNull(DomainValidator.getTLDEntries(ArrayType.COUNTRY_CODE_MINUS));
    375         assertNotNull(DomainValidator.getTLDEntries(ArrayType.COUNTRY_CODE_PLUS));
    376         assertNotNull(DomainValidator.getTLDEntries(ArrayType.GENERIC_MINUS));
    377         assertNotNull(DomainValidator.getTLDEntries(ArrayType.GENERIC_PLUS));
    378         assertNotNull(DomainValidator.getTLDEntries(ArrayType.COUNTRY_CODE_RO));
    379         assertNotNull(DomainValidator.getTLDEntries(ArrayType.GENERIC_RO));
    380         assertNotNull(DomainValidator.getTLDEntries(ArrayType.INFRASTRUCTURE_RO));
    381         assertNotNull(DomainValidator.getTLDEntries(ArrayType.LOCAL_RO));
     311    @ParameterizedTest
     312    @EnumSource(ArrayType.class)
     313    void testGetArray(ArrayType type) {
     314        assertNotNull(DomainValidator.getTLDEntries(type));
    382315    }
    383316
     
    388321    void testUpdateCountryCode() {
    389322        assertFalse(validator.isValidCountryCodeTld("com")); // cannot be valid
    390         DomainValidator.updateTLDOverride(ArrayType.COUNTRY_CODE_PLUS, new String[]{"com"});
     323        DomainValidator.updateTLDOverride(ArrayType.COUNTRY_CODE_PLUS, "com");
    391324        assertTrue(validator.isValidCountryCodeTld("com")); // it is now!
    392         DomainValidator.updateTLDOverride(ArrayType.COUNTRY_CODE_MINUS, new String[]{"com"});
     325        DomainValidator.updateTLDOverride(ArrayType.COUNTRY_CODE_MINUS, "com");
    393326        assertFalse(validator.isValidCountryCodeTld("com")); // show that minus overrides the rest
    394327
    395328        assertTrue(validator.isValidCountryCodeTld("ch"));
    396         DomainValidator.updateTLDOverride(ArrayType.COUNTRY_CODE_MINUS, new String[]{"ch"});
     329        DomainValidator.updateTLDOverride(ArrayType.COUNTRY_CODE_MINUS, "ch");
    397330        assertFalse(validator.isValidCountryCodeTld("ch"));
    398         DomainValidator.updateTLDOverride(ArrayType.COUNTRY_CODE_MINUS, new String[]{"xx"});
     331        DomainValidator.updateTLDOverride(ArrayType.COUNTRY_CODE_MINUS, "xx");
    399332        assertTrue(validator.isValidCountryCodeTld("ch"));
    400333    }
     
    406339    void testUpdateGeneric() {
    407340        assertFalse(validator.isValidGenericTld("ch")); // cannot be valid
    408         DomainValidator.updateTLDOverride(ArrayType.GENERIC_PLUS, new String[]{"ch"});
     341        DomainValidator.updateTLDOverride(ArrayType.GENERIC_PLUS, "ch");
    409342        assertTrue(validator.isValidGenericTld("ch")); // it is now!
    410         DomainValidator.updateTLDOverride(ArrayType.GENERIC_MINUS, new String[]{"ch"});
     343        DomainValidator.updateTLDOverride(ArrayType.GENERIC_MINUS, "ch");
    411344        assertFalse(validator.isValidGenericTld("ch")); // show that minus overrides the rest
    412345
    413346        assertTrue(validator.isValidGenericTld("com"));
    414         DomainValidator.updateTLDOverride(ArrayType.GENERIC_MINUS, new String[]{"com"});
     347        DomainValidator.updateTLDOverride(ArrayType.GENERIC_MINUS, "com");
    415348        assertFalse(validator.isValidGenericTld("com"));
    416         DomainValidator.updateTLDOverride(ArrayType.GENERIC_MINUS, new String[]{"xx"}); // change the minus list
     349        DomainValidator.updateTLDOverride(ArrayType.GENERIC_MINUS, "xx"); // change the minus list
    417350        assertTrue(validator.isValidGenericTld("com"));
    418351    }
     
    423356    @Test
    424357    void testCannotUpdate() {
    425         DomainValidator.updateTLDOverride(ArrayType.GENERIC_PLUS, new String[]{"ch"}); // OK
     358        DomainValidator.updateTLDOverride(ArrayType.GENERIC_PLUS, "ch"); // OK
    426359        DomainValidator dv = DomainValidator.getInstance();
    427360        assertNotNull(dv);
    428361        try {
    429             DomainValidator.updateTLDOverride(ArrayType.GENERIC_PLUS, new String[]{"ch"});
     362            DomainValidator.updateTLDOverride(ArrayType.GENERIC_PLUS, "ch");
    430363            fail("Expected IllegalStateException");
    431364        } catch (IllegalStateException ise) {
  • trunk/test/unit/org/openstreetmap/josm/data/validation/routines/DomainValidatorTestIT.java

    r17374 r18690  
    3535import java.net.URL;
    3636import java.nio.charset.StandardCharsets;
     37import java.nio.file.Files;
    3738import java.text.SimpleDateFormat;
    3839import java.util.Date;
    3940import java.util.HashMap;
    4041import java.util.HashSet;
    41 import java.util.Iterator;
    4242import java.util.Locale;
    4343import java.util.Map;
     
    102102        download(htmlFile, "http://www.iana.org/domains/root/db", timestamp);
    103103
    104         try (BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(txtFile), StandardCharsets.UTF_8))) {
     104        try (BufferedReader br = new BufferedReader(new InputStreamReader(Files.newInputStream(txtFile.toPath()), StandardCharsets.UTF_8))) {
    105105            String line;
    106106            final String header;
     
    186186            Logging.warn("        // Taken from " + header);
    187187        }
    188         Iterator<Map.Entry<String, String>> it = map.entrySet().iterator();
    189         while (it.hasNext()) {
    190             Map.Entry<String, String> me = it.next();
     188        for (Map.Entry<String, String> me : map.entrySet()) {
    191189            Logging.warn("        \"" + me.getKey() + "\", // " + me.getValue());
    192190        }
     
    202200        final Pattern comment = Pattern.compile("\\s+<td>([^<]+)</td>");
    203201
    204         try (BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(f), StandardCharsets.UTF_8))) {
     202        try (BufferedReader br = new BufferedReader(new InputStreamReader(Files.newInputStream(f.toPath()), StandardCharsets.UTF_8))) {
    205203            String line;
    206204            while ((line = br.readLine()) != null) {
     
    301299            File rootCheck = new File(System.getProperty("java.io.tmpdir"), "tld_" + domain + ".html");
    302300            download(rootCheck, tldurl, 0L);
    303             in = new BufferedReader(new InputStreamReader(new FileInputStream(rootCheck), StandardCharsets.UTF_8));
     301            in = new BufferedReader(new InputStreamReader(Files.newInputStream(rootCheck.toPath()), StandardCharsets.UTF_8));
    304302            String inputLine;
    305303            while ((inputLine = in.readLine()) != null) {
  • trunk/test/unit/org/openstreetmap/josm/data/validation/routines/EmailValidatorTest.java

    r17374 r18690  
    1717package org.openstreetmap.josm.data.validation.routines;
    1818
    19 import static org.junit.Assert.assertEquals;
    20 import static org.junit.Assert.assertFalse;
    21 import static org.junit.Assert.assertTrue;
     19import static org.junit.jupiter.api.Assertions.assertEquals;
     20import static org.junit.jupiter.api.Assertions.assertFalse;
     21import static org.junit.jupiter.api.Assertions.assertTrue;
    2222
    2323import org.junit.jupiter.api.BeforeEach;
     
    172172            return; // Cannot run the test
    173173        }
    174         assertTrue("xn--d1abbgf6aiiy.xn--p1ai should validate", validator.isValid("someone@xn--d1abbgf6aiiy.xn--p1ai"));
    175         assertTrue("президент.рф should validate", validator.isValid("someone@президент.рф"));
    176         assertTrue("www.b\u00fccher.ch should validate", validator.isValid("someone@www.b\u00fccher.ch"));
    177         assertFalse("www.\uFFFD.ch FFFD should fail", validator.isValid("someone@www.\uFFFD.ch"));
    178         assertTrue("www.b\u00fccher.ch should validate", validator.isValid("someone@www.b\u00fccher.ch"));
    179         assertFalse("www.\uFFFD.ch FFFD should fail", validator.isValid("someone@www.\uFFFD.ch"));
     174        assertTrue(validator.isValid("someone@xn--d1abbgf6aiiy.xn--p1ai"), "xn--d1abbgf6aiiy.xn--p1ai should validate");
     175        assertTrue(validator.isValid("someone@президент.рф"), "президент.рф should validate");
     176        assertTrue(validator.isValid("someone@www.b\u00fccher.ch"), "www.b\u00fccher.ch should validate");
     177        assertFalse(validator.isValid("someone@www.\uFFFD.ch"), "www.\uFFFD.ch FFFD should fail");
     178        assertTrue(validator.isValid("someone@www.b\u00fccher.ch"), "www.b\u00fccher.ch should validate");
     179        assertFalse(validator.isValid("someone@www.\uFFFD.ch"), "www.\uFFFD.ch FFFD should fail");
    180180    }
    181181
     
    217217    void testEmailWithControlChars() {
    218218        for (char c = 0; c < 32; c++) {
    219             assertFalse("Test control char " + ((int) c), validator.isValid("foo" + c + "bar@domain.com"));
     219            assertFalse(validator.isValid("foo" + c + "bar@domain.com"), "Test control char " + ((int) c));
    220220        }
    221         assertFalse("Test control char 127", validator.isValid("foo" + ((char) 127) + "bar@domain.com"));
     221        assertFalse(validator.isValid("foo" + ((char) 127) + "bar@domain.com"), "Test control char 127");
    222222    }
    223223
     
    234234
    235235       // Depends on the validator
    236        assertTrue(
    237              "@localhost.localdomain should be accepted but wasn't",
    238              allowLocal.isValid("joe@localhost.localdomain")
    239        );
    240        assertTrue(
    241              "@localhost should be accepted but wasn't",
    242              allowLocal.isValid("joe@localhost")
    243        );
    244 
    245        assertFalse(
    246              "@localhost.localdomain should be accepted but wasn't",
    247              noLocal.isValid("joe@localhost.localdomain")
    248        );
    249        assertFalse(
    250              "@localhost should be accepted but wasn't",
    251              noLocal.isValid("joe@localhost")
    252        );
     236       assertTrue(allowLocal.isValid("joe@localhost.localdomain"), "@localhost.localdomain should be accepted but wasn't");
     237       assertTrue(allowLocal.isValid("joe@localhost"), "@localhost should be accepted but wasn't");
     238
     239       assertFalse(noLocal.isValid("joe@localhost.localdomain"), "@localhost.localdomain should be accepted but wasn't");
     240       assertFalse(noLocal.isValid("joe@localhost"), "@localhost should be accepted but wasn't");
    253241    }
    254242
     
    259247    @Test
    260248    void testEmailWithSlashes() {
    261        assertTrue(
    262              "/ and ! valid in username",
    263              validator.isValid("joe!/blow@apache.org")
    264        );
    265        assertFalse(
    266              "/ not valid in domain",
    267              validator.isValid("joe@ap/ache.org")
    268        );
    269        assertFalse(
    270              "! not valid in domain",
    271              validator.isValid("joe@apac!he.org")
    272        );
     249       assertTrue(validator.isValid("joe!/blow@apache.org"), "/ and ! valid in username");
     250       assertFalse(validator.isValid("joe@ap/ache.org"), "/ not valid in domain");
     251       assertFalse(validator.isValid("joe@apac!he.org"), "! not valid in domain");
    273252    }
    274253
     
    496475            String item = resultPair.item;
    497476            if (resultPair.valid) {
    498                 assertTrue("Should be OK: " + item, validator.isValid(item));
     477                assertTrue(validator.isValid(item), "Should be OK: " + item);
    499478            } else {
    500                 assertFalse("Should fail: " + item, validator.isValid(item));
     479                assertFalse(validator.isValid(item), "Should fail: " + item);
    501480            }
    502481        }
  • trunk/test/unit/org/openstreetmap/josm/data/validation/routines/InetAddressValidatorTest.java

    r17275 r18690  
    1717package org.openstreetmap.josm.data.validation.routines;
    1818
    19 import static org.junit.Assert.assertFalse;
    20 import static org.junit.Assert.assertNull;
    21 import static org.junit.Assert.assertTrue;
     19import static org.junit.jupiter.api.Assertions.assertFalse;
     20import static org.junit.jupiter.api.Assertions.assertNull;
     21import static org.junit.jupiter.api.Assertions.assertTrue;
    2222
    2323import org.junit.jupiter.api.BeforeEach;
     
    4747    void testInetAddressesFromTheWild() {
    4848        // CHECKSTYLE.OFF: SingleSpaceSeparator
    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        assertTrue(validator.isValid("140.211.11.130"), "www.apache.org IP should be valid");
     50        assertTrue(validator.isValid("72.14.253.103"), "www.l.google.com IP should be valid");
     51        assertTrue(validator.isValid("199.232.41.5"), "fsf.org IP should be valid");
     52        assertTrue(validator.isValid("216.35.123.87"), "appscs.ign.com IP should be valid");
    5353        // CHECKSTYLE.ON: SingleSpaceSeparator
    5454    }
     
    5959    @Test
    6060    void testVALIDATOR_335() {
    61         assertTrue("2001:0438:FFFE:0000:0000:0000:0000:0A35 should be valid",
    62                 validator.isValid("2001:0438:FFFE:0000:0000:0000:0000:0A35"));
     61        assertTrue(validator.isValid("2001:0438:FFFE:0000:0000:0000:0000:0A35"), "2001:0438:FFFE:0000:0000:0000:0000:0A35 should be valid");
    6362    }
    6463
     
    6968    void testInetAddressesByClass() {
    7069        // CHECKSTYLE.OFF: SingleSpaceSeparator
    71         assertTrue("class A IP should be valid",            validator.isValid("24.25.231.12"));
    72         assertFalse("illegal class A IP should be invalid", validator.isValid("2.41.32.324"));
    73 
    74         assertTrue("class B IP should be valid",            validator.isValid("135.14.44.12"));
    75         assertFalse("illegal class B IP should be invalid", validator.isValid("154.123.441.123"));
    76 
    77         assertTrue("class C IP should be valid",            validator.isValid("213.25.224.32"));
    78         assertFalse("illegal class C IP should be invalid", validator.isValid("201.543.23.11"));
    79 
    80         assertTrue("class D IP should be valid",            validator.isValid("229.35.159.6"));
    81         assertFalse("illegal class D IP should be invalid", validator.isValid("231.54.11.987"));
    82 
    83         assertTrue("class E IP should be valid",            validator.isValid("248.85.24.92"));
    84         assertFalse("illegal class E IP should be invalid", validator.isValid("250.21.323.48"));
     70        assertTrue(validator.isValid("24.25.231.12"), "class A IP should be valid");
     71        assertFalse(validator.isValid("2.41.32.324"), "illegal class A IP should be invalid");
     72
     73        assertTrue(validator.isValid("135.14.44.12"), "class B IP should be valid");
     74        assertFalse(validator.isValid("154.123.441.123"), "illegal class B IP should be invalid");
     75
     76        assertTrue(validator.isValid("213.25.224.32"), "class C IP should be valid");
     77        assertFalse(validator.isValid("201.543.23.11"), "illegal class C IP should be invalid");
     78
     79        assertTrue(validator.isValid("229.35.159.6"), "class D IP should be valid");
     80        assertFalse(validator.isValid("231.54.11.987"), "illegal class D IP should be invalid");
     81
     82        assertTrue(validator.isValid("248.85.24.92"), "class E IP should be valid");
     83        assertFalse(validator.isValid("250.21.323.48"), "illegal class E IP should be invalid");
    8584        // CHECKSTYLE.ON: SingleSpaceSeparator
    8685    }
     
    9190    @Test
    9291    void testReservedInetAddresses() {
    93         assertTrue("localhost IP should be valid", validator.isValid("127.0.0.1"));
    94         assertTrue("broadcast IP should be valid", validator.isValid("255.255.255.255"));
     92        assertTrue(validator.isValid("127.0.0.1"), "localhost IP should be valid");
     93        assertTrue(validator.isValid("255.255.255.255"), "broadcast IP should be valid");
    9594    }
    9695
     
    101100    void testBrokenInetAddresses() {
    102101        // CHECKSTYLE.OFF: SingleSpaceSeparator
    103         assertFalse("IP with characters should be invalid",     validator.isValid("124.14.32.abc"));
    104         assertFalse("IP with leading zeroes should be invalid", validator.isValid("124.14.32.01"));
    105         assertFalse("IP with three groups should be invalid",   validator.isValid("23.64.12"));
    106         assertFalse("IP with five groups should be invalid",    validator.isValid("26.34.23.77.234"));
     102        assertFalse(validator.isValid("124.14.32.abc"), "IP with characters should be invalid");
     103        assertFalse(validator.isValid("124.14.32.01"), "IP with leading zeroes should be invalid");
     104        assertFalse(validator.isValid("23.64.12"), "IP with three groups should be invalid");
     105        assertFalse(validator.isValid("26.34.23.77.234"), "IP with five groups should be invalid");
    107106        // CHECKSTYLE.ON: SingleSpaceSeparator
    108107    }
     
    121120        // The original Perl script contained a lot of duplicate tests.
    122121        // I removed the duplicates I noticed, but there may be more.
    123         assertFalse("IPV6 empty string should be invalid", validator.isValidInet6Address("")); // empty string
    124         assertTrue("IPV6 ::1 should be valid", validator.isValidInet6Address("::1")); // loopback, compressed, non-routable
    125         assertTrue("IPV6 :: should be valid", validator.isValidInet6Address("::")); // unspecified, compressed, non-routable
    126         assertTrue("IPV6 0:0:0:0:0:0:0:1 should be valid", validator.isValidInet6Address("0:0:0:0:0:0:0:1")); // loopback, full
    127         assertTrue("IPV6 0:0:0:0:0:0:0:0 should be valid", validator.isValidInet6Address("0:0:0:0:0:0:0:0")); // unspecified, full
    128         assertTrue("IPV6 2001:DB8:0:0:8:800:200C:417A should be valid", validator.isValidInet6Address("2001:DB8:0:0:8:800:200C:417A")); // unicast, full
    129         assertTrue("IPV6 FF01:0:0:0:0:0:0:101 should be valid", validator.isValidInet6Address("FF01:0:0:0:0:0:0:101")); // multicast, full
    130         assertTrue("IPV6 2001:DB8::8:800:200C:417A should be valid", validator.isValidInet6Address("2001:DB8::8:800:200C:417A")); // unicast, compressed
    131         assertTrue("IPV6 FF01::101 should be valid", validator.isValidInet6Address("FF01::101")); // multicast, compressed
    132         assertFalse("IPV6 2001:DB8:0:0:8:800:200C:417A:221 should be invalid", validator.isValidInet6Address("2001:DB8:0:0:8:800:200C:417A:221")); // unicast, full
    133         assertFalse("IPV6 FF01::101::2 should be invalid", validator.isValidInet6Address("FF01::101::2")); // multicast, compressed
    134         assertTrue("IPV6 fe80::217:f2ff:fe07:ed62 should be valid", validator.isValidInet6Address("fe80::217:f2ff:fe07:ed62"));
    135         assertTrue("IPV6 2001:0000:1234:0000:0000:C1C0:ABCD:0876 should be valid", validator.isValidInet6Address("2001:0000:1234:0000:0000:C1C0:ABCD:0876"));
    136         assertTrue("IPV6 3ffe:0b00:0000:0000:0001:0000:0000:000a should be valid", validator.isValidInet6Address("3ffe:0b00:0000:0000:0001:0000:0000:000a"));
    137         assertTrue("IPV6 FF02:0000:0000:0000:0000:0000:0000:0001 should be valid", validator.isValidInet6Address("FF02:0000:0000:0000:0000:0000:0000:0001"));
    138         assertTrue("IPV6 0000:0000:0000:0000:0000:0000:0000:0001 should be valid", validator.isValidInet6Address("0000:0000:0000:0000:0000:0000:0000:0001"));
    139         assertTrue("IPV6 0000:0000:0000:0000:0000:0000:0000:0000 should be valid", validator.isValidInet6Address("0000:0000:0000:0000:0000:0000:0000:0000"));
    140         assertFalse("IPV6 02001:0000:1234:0000:0000:C1C0:ABCD:0876 should be invalid", validator.isValidInet6Address("02001:0000:1234:0000:0000:C1C0:ABCD:0876")); // extra 0 not allowed!
    141         assertFalse("IPV6 2001:0000:1234:0000:00001:C1C0:ABCD:0876 should be invalid", validator.isValidInet6Address("2001:0000:1234:0000:00001:C1C0:ABCD:0876")); // extra 0 not allowed!
    142         assertFalse("IPV6 2001:0000:1234:0000:0000:C1C0:ABCD:0876 0 should be invalid", validator.isValidInet6Address("2001:0000:1234:0000:0000:C1C0:ABCD:0876 0")); // junk after valid address
    143         assertFalse("IPV6 2001:0000:1234: 0000:0000:C1C0:ABCD:0876 should be invalid", validator.isValidInet6Address("2001:0000:1234: 0000:0000:C1C0:ABCD:0876")); // internal space
    144         assertFalse("IPV6 3ffe:0b00:0000:0001:0000:0000:000a should be invalid", validator.isValidInet6Address("3ffe:0b00:0000:0001:0000:0000:000a")); // seven segments
    145         assertFalse("IPV6 FF02:0000:0000:0000:0000:0000:0000:0000:0001 should be invalid", validator.isValidInet6Address("FF02:0000:0000:0000:0000:0000:0000:0000:0001")); // nine segments
    146         assertFalse("IPV6 3ffe:b00::1::a should be invalid", validator.isValidInet6Address("3ffe:b00::1::a")); // double "::"
    147         assertFalse("IPV6 ::1111:2222:3333:4444:5555:6666:: should be invalid", validator.isValidInet6Address("::1111:2222:3333:4444:5555:6666::")); // double "::"
    148         assertTrue("IPV6 2::10 should be valid", validator.isValidInet6Address("2::10"));
    149         assertTrue("IPV6 ff02::1 should be valid", validator.isValidInet6Address("ff02::1"));
    150         assertTrue("IPV6 fe80:: should be valid", validator.isValidInet6Address("fe80::"));
    151         assertTrue("IPV6 2002:: should be valid", validator.isValidInet6Address("2002::"));
    152         assertTrue("IPV6 2001:db8:: should be valid", validator.isValidInet6Address("2001:db8::"));
    153         assertTrue("IPV6 2001:0db8:1234:: should be valid", validator.isValidInet6Address("2001:0db8:1234::"));
    154         assertTrue("IPV6 ::ffff:0:0 should be valid", validator.isValidInet6Address("::ffff:0:0"));
    155         assertTrue("IPV6 1:2:3:4:5:6:7:8 should be valid", validator.isValidInet6Address("1:2:3:4:5:6:7:8"));
    156         assertTrue("IPV6 1:2:3:4:5:6::8 should be valid", validator.isValidInet6Address("1:2:3:4:5:6::8"));
    157         assertTrue("IPV6 1:2:3:4:5::8 should be valid", validator.isValidInet6Address("1:2:3:4:5::8"));
    158         assertTrue("IPV6 1:2:3:4::8 should be valid", validator.isValidInet6Address("1:2:3:4::8"));
    159         assertTrue("IPV6 1:2:3::8 should be valid", validator.isValidInet6Address("1:2:3::8"));
    160         assertTrue("IPV6 1:2::8 should be valid", validator.isValidInet6Address("1:2::8"));
    161         assertTrue("IPV6 1::8 should be valid", validator.isValidInet6Address("1::8"));
    162         assertTrue("IPV6 1::2:3:4:5:6:7 should be valid", validator.isValidInet6Address("1::2:3:4:5:6:7"));
    163         assertTrue("IPV6 1::2:3:4:5:6 should be valid", validator.isValidInet6Address("1::2:3:4:5:6"));
    164         assertTrue("IPV6 1::2:3:4:5 should be valid", validator.isValidInet6Address("1::2:3:4:5"));
    165         assertTrue("IPV6 1::2:3:4 should be valid", validator.isValidInet6Address("1::2:3:4"));
    166         assertTrue("IPV6 1::2:3 should be valid", validator.isValidInet6Address("1::2:3"));
    167         assertTrue("IPV6 ::2:3:4:5:6:7:8 should be valid", validator.isValidInet6Address("::2:3:4:5:6:7:8"));
    168         assertTrue("IPV6 ::2:3:4:5:6:7 should be valid", validator.isValidInet6Address("::2:3:4:5:6:7"));
    169         assertTrue("IPV6 ::2:3:4:5:6 should be valid", validator.isValidInet6Address("::2:3:4:5:6"));
    170         assertTrue("IPV6 ::2:3:4:5 should be valid", validator.isValidInet6Address("::2:3:4:5"));
    171         assertTrue("IPV6 ::2:3:4 should be valid", validator.isValidInet6Address("::2:3:4"));
    172         assertTrue("IPV6 ::2:3 should be valid", validator.isValidInet6Address("::2:3"));
    173         assertTrue("IPV6 ::8 should be valid", validator.isValidInet6Address("::8"));
    174         assertTrue("IPV6 1:2:3:4:5:6:: should be valid", validator.isValidInet6Address("1:2:3:4:5:6::"));
    175         assertTrue("IPV6 1:2:3:4:5:: should be valid", validator.isValidInet6Address("1:2:3:4:5::"));
    176         assertTrue("IPV6 1:2:3:4:: should be valid", validator.isValidInet6Address("1:2:3:4::"));
    177         assertTrue("IPV6 1:2:3:: should be valid", validator.isValidInet6Address("1:2:3::"));
    178         assertTrue("IPV6 1:2:: should be valid", validator.isValidInet6Address("1:2::"));
    179         assertTrue("IPV6 1:: should be valid", validator.isValidInet6Address("1::"));
    180         assertTrue("IPV6 1:2:3:4:5::7:8 should be valid", validator.isValidInet6Address("1:2:3:4:5::7:8"));
    181         assertFalse("IPV6 1:2:3::4:5::7:8 should be invalid", validator.isValidInet6Address("1:2:3::4:5::7:8")); // Double "::"
    182         assertFalse("IPV6 12345::6:7:8 should be invalid", validator.isValidInet6Address("12345::6:7:8"));
    183         assertTrue("IPV6 1:2:3:4::7:8 should be valid", validator.isValidInet6Address("1:2:3:4::7:8"));
    184         assertTrue("IPV6 1:2:3::7:8 should be valid", validator.isValidInet6Address("1:2:3::7:8"));
    185         assertTrue("IPV6 1:2::7:8 should be valid", validator.isValidInet6Address("1:2::7:8"));
    186         assertTrue("IPV6 1::7:8 should be valid", validator.isValidInet6Address("1::7:8"));
     122        assertFalse(validator.isValidInet6Address(""), "IPV6 empty string should be invalid"); // empty string
     123        assertTrue(validator.isValidInet6Address("::1"), "IPV6 ::1 should be valid"); // loopback, compressed, non-routable
     124        assertTrue(validator.isValidInet6Address("::"), "IPV6 :: should be valid"); // unspecified, compressed, non-routable
     125        assertTrue(validator.isValidInet6Address("0:0:0:0:0:0:0:1"), "IPV6 0:0:0:0:0:0:0:1 should be valid"); // loopback, full
     126        assertTrue(validator.isValidInet6Address("0:0:0:0:0:0:0:0"), "IPV6 0:0:0:0:0:0:0:0 should be valid"); // unspecified, full
     127        assertTrue(validator.isValidInet6Address("2001:DB8:0:0:8:800:200C:417A"), "IPV6 2001:DB8:0:0:8:800:200C:417A should be valid"); // unicast, full
     128        assertTrue(validator.isValidInet6Address("FF01:0:0:0:0:0:0:101"), "IPV6 FF01:0:0:0:0:0:0:101 should be valid"); // multicast, full
     129        assertTrue(validator.isValidInet6Address("2001:DB8::8:800:200C:417A"), "IPV6 2001:DB8::8:800:200C:417A should be valid"); // unicast, compressed
     130        assertTrue(validator.isValidInet6Address("FF01::101"), "IPV6 FF01::101 should be valid"); // multicast, compressed
     131        assertFalse(validator.isValidInet6Address("2001:DB8:0:0:8:800:200C:417A:221"), "IPV6 2001:DB8:0:0:8:800:200C:417A:221 should be invalid"); // unicast, full
     132        assertFalse(validator.isValidInet6Address("FF01::101::2"), "IPV6 FF01::101::2 should be invalid"); // multicast, compressed
     133        assertTrue(validator.isValidInet6Address("fe80::217:f2ff:fe07:ed62"), "IPV6 fe80::217:f2ff:fe07:ed62 should be valid");
     134        assertTrue(validator.isValidInet6Address("2001:0000:1234:0000:0000:C1C0:ABCD:0876"), "IPV6 2001:0000:1234:0000:0000:C1C0:ABCD:0876 should be valid");
     135        assertTrue(validator.isValidInet6Address("3ffe:0b00:0000:0000:0001:0000:0000:000a"), "IPV6 3ffe:0b00:0000:0000:0001:0000:0000:000a should be valid");
     136        assertTrue(validator.isValidInet6Address("FF02:0000:0000:0000:0000:0000:0000:0001"), "IPV6 FF02:0000:0000:0000:0000:0000:0000:0001 should be valid");
     137        assertTrue(validator.isValidInet6Address("0000:0000:0000:0000:0000:0000:0000:0001"), "IPV6 0000:0000:0000:0000:0000:0000:0000:0001 should be valid");
     138        assertTrue(validator.isValidInet6Address("0000:0000:0000:0000:0000:0000:0000:0000"), "IPV6 0000:0000:0000:0000:0000:0000:0000:0000 should be valid");
     139        assertFalse(validator.isValidInet6Address("02001:0000:1234:0000:0000:C1C0:ABCD:0876"), "IPV6 02001:0000:1234:0000:0000:C1C0:ABCD:0876 should be invalid"); // extra 0 not allowed!
     140        assertFalse(validator.isValidInet6Address("2001:0000:1234:0000:00001:C1C0:ABCD:0876"), "IPV6 2001:0000:1234:0000:00001:C1C0:ABCD:0876 should be invalid"); // extra 0 not allowed!
     141        assertFalse(validator.isValidInet6Address("2001:0000:1234:0000:0000:C1C0:ABCD:0876 0"), "IPV6 2001:0000:1234:0000:0000:C1C0:ABCD:0876 0 should be invalid"); // junk after valid address
     142        assertFalse(validator.isValidInet6Address("2001:0000:1234: 0000:0000:C1C0:ABCD:0876"), "IPV6 2001:0000:1234: 0000:0000:C1C0:ABCD:0876 should be invalid"); // internal space
     143        assertFalse(validator.isValidInet6Address("3ffe:0b00:0000:0001:0000:0000:000a"), "IPV6 3ffe:0b00:0000:0001:0000:0000:000a should be invalid"); // seven segments
     144        assertFalse(validator.isValidInet6Address("FF02:0000:0000:0000:0000:0000:0000:0000:0001"), "IPV6 FF02:0000:0000:0000:0000:0000:0000:0000:0001 should be invalid"); // nine segments
     145        assertFalse(validator.isValidInet6Address("3ffe:b00::1::a"), "IPV6 3ffe:b00::1::a should be invalid"); // double "::"
     146        assertFalse(validator.isValidInet6Address("::1111:2222:3333:4444:5555:6666::"), "IPV6 ::1111:2222:3333:4444:5555:6666:: should be invalid"); // double "::"
     147        assertTrue(validator.isValidInet6Address("2::10"), "IPV6 2::10 should be valid");
     148        assertTrue(validator.isValidInet6Address("ff02::1"), "IPV6 ff02::1 should be valid");
     149        assertTrue(validator.isValidInet6Address("fe80::"), "IPV6 fe80:: should be valid");
     150        assertTrue(validator.isValidInet6Address("2002::"), "IPV6 2002:: should be valid");
     151        assertTrue(validator.isValidInet6Address("2001:db8::"), "IPV6 2001:db8:: should be valid");
     152        assertTrue(validator.isValidInet6Address("2001:0db8:1234::"), "IPV6 2001:0db8:1234:: should be valid");
     153        assertTrue(validator.isValidInet6Address("::ffff:0:0"), "IPV6 ::ffff:0:0 should be valid");
     154        assertTrue(validator.isValidInet6Address("1:2:3:4:5:6:7:8"), "IPV6 1:2:3:4:5:6:7:8 should be valid");
     155        assertTrue(validator.isValidInet6Address("1:2:3:4:5:6::8"), "IPV6 1:2:3:4:5:6::8 should be valid");
     156        assertTrue(validator.isValidInet6Address("1:2:3:4:5::8"), "IPV6 1:2:3:4:5::8 should be valid");
     157        assertTrue(validator.isValidInet6Address("1:2:3:4::8"), "IPV6 1:2:3:4::8 should be valid");
     158        assertTrue(validator.isValidInet6Address("1:2:3::8"), "IPV6 1:2:3::8 should be valid");
     159        assertTrue(validator.isValidInet6Address("1:2::8"), "IPV6 1:2::8 should be valid");
     160        assertTrue(validator.isValidInet6Address("1::8"), "IPV6 1::8 should be valid");
     161        assertTrue(validator.isValidInet6Address("1::2:3:4:5:6:7"), "IPV6 1::2:3:4:5:6:7 should be valid");
     162        assertTrue(validator.isValidInet6Address("1::2:3:4:5:6"), "IPV6 1::2:3:4:5:6 should be valid");
     163        assertTrue(validator.isValidInet6Address("1::2:3:4:5"), "IPV6 1::2:3:4:5 should be valid");
     164        assertTrue(validator.isValidInet6Address("1::2:3:4"), "IPV6 1::2:3:4 should be valid");
     165        assertTrue(validator.isValidInet6Address("1::2:3"), "IPV6 1::2:3 should be valid");
     166        assertTrue(validator.isValidInet6Address("::2:3:4:5:6:7:8"), "IPV6 ::2:3:4:5:6:7:8 should be valid");
     167        assertTrue(validator.isValidInet6Address("::2:3:4:5:6:7"), "IPV6 ::2:3:4:5:6:7 should be valid");
     168        assertTrue(validator.isValidInet6Address("::2:3:4:5:6"), "IPV6 ::2:3:4:5:6 should be valid");
     169        assertTrue(validator.isValidInet6Address("::2:3:4:5"), "IPV6 ::2:3:4:5 should be valid");
     170        assertTrue(validator.isValidInet6Address("::2:3:4"), "IPV6 ::2:3:4 should be valid");
     171        assertTrue(validator.isValidInet6Address("::2:3"), "IPV6 ::2:3 should be valid");
     172        assertTrue(validator.isValidInet6Address("::8"), "IPV6 ::8 should be valid");
     173        assertTrue(validator.isValidInet6Address("1:2:3:4:5:6::"), "IPV6 1:2:3:4:5:6:: should be valid");
     174        assertTrue(validator.isValidInet6Address("1:2:3:4:5::"), "IPV6 1:2:3:4:5:: should be valid");
     175        assertTrue(validator.isValidInet6Address("1:2:3:4::"), "IPV6 1:2:3:4:: should be valid");
     176        assertTrue(validator.isValidInet6Address("1:2:3::"), "IPV6 1:2:3:: should be valid");
     177        assertTrue(validator.isValidInet6Address("1:2::"), "IPV6 1:2:: should be valid");
     178        assertTrue(validator.isValidInet6Address("1::"), "IPV6 1:: should be valid");
     179        assertTrue(validator.isValidInet6Address("1:2:3:4:5::7:8"), "IPV6 1:2:3:4:5::7:8 should be valid");
     180        assertFalse(validator.isValidInet6Address("1:2:3::4:5::7:8"), "IPV6 1:2:3::4:5::7:8 should be invalid"); // Double "::"
     181        assertFalse(validator.isValidInet6Address("12345::6:7:8"), "IPV6 12345::6:7:8 should be invalid");
     182        assertTrue(validator.isValidInet6Address("1:2:3:4::7:8"), "IPV6 1:2:3:4::7:8 should be valid");
     183        assertTrue(validator.isValidInet6Address("1:2:3::7:8"), "IPV6 1:2:3::7:8 should be valid");
     184        assertTrue(validator.isValidInet6Address("1:2::7:8"), "IPV6 1:2::7:8 should be valid");
     185        assertTrue(validator.isValidInet6Address("1::7:8"), "IPV6 1::7:8 should be valid");
    187186        // IPv4 addresses as dotted-quads
    188         assertTrue("IPV6 1:2:3:4:5:6:1.2.3.4 should be valid", validator.isValidInet6Address("1:2:3:4:5:6:1.2.3.4"));
    189         assertTrue("IPV6 1:2:3:4:5::1.2.3.4 should be valid", validator.isValidInet6Address("1:2:3:4:5::1.2.3.4"));
    190         assertTrue("IPV6 1:2:3:4::1.2.3.4 should be valid", validator.isValidInet6Address("1:2:3:4::1.2.3.4"));
    191         assertTrue("IPV6 1:2:3::1.2.3.4 should be valid", validator.isValidInet6Address("1:2:3::1.2.3.4"));
    192         assertTrue("IPV6 1:2::1.2.3.4 should be valid", validator.isValidInet6Address("1:2::1.2.3.4"));
    193         assertTrue("IPV6 1::1.2.3.4 should be valid", validator.isValidInet6Address("1::1.2.3.4"));
    194         assertTrue("IPV6 1:2:3:4::5:1.2.3.4 should be valid", validator.isValidInet6Address("1:2:3:4::5:1.2.3.4"));
    195         assertTrue("IPV6 1:2:3::5:1.2.3.4 should be valid", validator.isValidInet6Address("1:2:3::5:1.2.3.4"));
    196         assertTrue("IPV6 1:2::5:1.2.3.4 should be valid", validator.isValidInet6Address("1:2::5:1.2.3.4"));
    197         assertTrue("IPV6 1::5:1.2.3.4 should be valid", validator.isValidInet6Address("1::5:1.2.3.4"));
    198         assertTrue("IPV6 1::5:11.22.33.44 should be valid", validator.isValidInet6Address("1::5:11.22.33.44"));
    199         assertFalse("IPV6 1::5:400.2.3.4 should be invalid", validator.isValidInet6Address("1::5:400.2.3.4"));
    200         assertFalse("IPV6 1::5:260.2.3.4 should be invalid", validator.isValidInet6Address("1::5:260.2.3.4"));
    201         assertFalse("IPV6 1::5:256.2.3.4 should be invalid", validator.isValidInet6Address("1::5:256.2.3.4"));
    202         assertFalse("IPV6 1::5:1.256.3.4 should be invalid", validator.isValidInet6Address("1::5:1.256.3.4"));
    203         assertFalse("IPV6 1::5:1.2.256.4 should be invalid", validator.isValidInet6Address("1::5:1.2.256.4"));
    204         assertFalse("IPV6 1::5:1.2.3.256 should be invalid", validator.isValidInet6Address("1::5:1.2.3.256"));
    205         assertFalse("IPV6 1::5:300.2.3.4 should be invalid", validator.isValidInet6Address("1::5:300.2.3.4"));
    206         assertFalse("IPV6 1::5:1.300.3.4 should be invalid", validator.isValidInet6Address("1::5:1.300.3.4"));
    207         assertFalse("IPV6 1::5:1.2.300.4 should be invalid", validator.isValidInet6Address("1::5:1.2.300.4"));
    208         assertFalse("IPV6 1::5:1.2.3.300 should be invalid", validator.isValidInet6Address("1::5:1.2.3.300"));
    209         assertFalse("IPV6 1::5:900.2.3.4 should be invalid", validator.isValidInet6Address("1::5:900.2.3.4"));
    210         assertFalse("IPV6 1::5:1.900.3.4 should be invalid", validator.isValidInet6Address("1::5:1.900.3.4"));
    211         assertFalse("IPV6 1::5:1.2.900.4 should be invalid", validator.isValidInet6Address("1::5:1.2.900.4"));
    212         assertFalse("IPV6 1::5:1.2.3.900 should be invalid", validator.isValidInet6Address("1::5:1.2.3.900"));
    213         assertFalse("IPV6 1::5:300.300.300.300 should be invalid", validator.isValidInet6Address("1::5:300.300.300.300"));
    214         assertFalse("IPV6 1::5:3000.30.30.30 should be invalid", validator.isValidInet6Address("1::5:3000.30.30.30"));
    215         assertFalse("IPV6 1::400.2.3.4 should be invalid", validator.isValidInet6Address("1::400.2.3.4"));
    216         assertFalse("IPV6 1::260.2.3.4 should be invalid", validator.isValidInet6Address("1::260.2.3.4"));
    217         assertFalse("IPV6 1::256.2.3.4 should be invalid", validator.isValidInet6Address("1::256.2.3.4"));
    218         assertFalse("IPV6 1::1.256.3.4 should be invalid", validator.isValidInet6Address("1::1.256.3.4"));
    219         assertFalse("IPV6 1::1.2.256.4 should be invalid", validator.isValidInet6Address("1::1.2.256.4"));
    220         assertFalse("IPV6 1::1.2.3.256 should be invalid", validator.isValidInet6Address("1::1.2.3.256"));
    221         assertFalse("IPV6 1::300.2.3.4 should be invalid", validator.isValidInet6Address("1::300.2.3.4"));
    222         assertFalse("IPV6 1::1.300.3.4 should be invalid", validator.isValidInet6Address("1::1.300.3.4"));
    223         assertFalse("IPV6 1::1.2.300.4 should be invalid", validator.isValidInet6Address("1::1.2.300.4"));
    224         assertFalse("IPV6 1::1.2.3.300 should be invalid", validator.isValidInet6Address("1::1.2.3.300"));
    225         assertFalse("IPV6 1::900.2.3.4 should be invalid", validator.isValidInet6Address("1::900.2.3.4"));
    226         assertFalse("IPV6 1::1.900.3.4 should be invalid", validator.isValidInet6Address("1::1.900.3.4"));
    227         assertFalse("IPV6 1::1.2.900.4 should be invalid", validator.isValidInet6Address("1::1.2.900.4"));
    228         assertFalse("IPV6 1::1.2.3.900 should be invalid", validator.isValidInet6Address("1::1.2.3.900"));
    229         assertFalse("IPV6 1::300.300.300.300 should be invalid", validator.isValidInet6Address("1::300.300.300.300"));
    230         assertFalse("IPV6 1::3000.30.30.30 should be invalid", validator.isValidInet6Address("1::3000.30.30.30"));
    231         assertFalse("IPV6 ::400.2.3.4 should be invalid", validator.isValidInet6Address("::400.2.3.4"));
    232         assertFalse("IPV6 ::260.2.3.4 should be invalid", validator.isValidInet6Address("::260.2.3.4"));
    233         assertFalse("IPV6 ::256.2.3.4 should be invalid", validator.isValidInet6Address("::256.2.3.4"));
    234         assertFalse("IPV6 ::1.256.3.4 should be invalid", validator.isValidInet6Address("::1.256.3.4"));
    235         assertFalse("IPV6 ::1.2.256.4 should be invalid", validator.isValidInet6Address("::1.2.256.4"));
    236         assertFalse("IPV6 ::1.2.3.256 should be invalid", validator.isValidInet6Address("::1.2.3.256"));
    237         assertFalse("IPV6 ::300.2.3.4 should be invalid", validator.isValidInet6Address("::300.2.3.4"));
    238         assertFalse("IPV6 ::1.300.3.4 should be invalid", validator.isValidInet6Address("::1.300.3.4"));
    239         assertFalse("IPV6 ::1.2.300.4 should be invalid", validator.isValidInet6Address("::1.2.300.4"));
    240         assertFalse("IPV6 ::1.2.3.300 should be invalid", validator.isValidInet6Address("::1.2.3.300"));
    241         assertFalse("IPV6 ::900.2.3.4 should be invalid", validator.isValidInet6Address("::900.2.3.4"));
    242         assertFalse("IPV6 ::1.900.3.4 should be invalid", validator.isValidInet6Address("::1.900.3.4"));
    243         assertFalse("IPV6 ::1.2.900.4 should be invalid", validator.isValidInet6Address("::1.2.900.4"));
    244         assertFalse("IPV6 ::1.2.3.900 should be invalid", validator.isValidInet6Address("::1.2.3.900"));
    245         assertFalse("IPV6 ::300.300.300.300 should be invalid", validator.isValidInet6Address("::300.300.300.300"));
    246         assertFalse("IPV6 ::3000.30.30.30 should be invalid", validator.isValidInet6Address("::3000.30.30.30"));
    247         assertTrue("IPV6 fe80::217:f2ff:254.7.237.98 should be valid", validator.isValidInet6Address("fe80::217:f2ff:254.7.237.98"));
    248         assertTrue("IPV6 ::ffff:192.168.1.26 should be valid", validator.isValidInet6Address("::ffff:192.168.1.26"));
    249         assertFalse("IPV6 2001:1:1:1:1:1:255Z255X255Y255 should be invalid", validator.isValidInet6Address("2001:1:1:1:1:1:255Z255X255Y255")); // garbage instead of "." in IPv4
    250         assertFalse("IPV6 ::ffff:192x168.1.26 should be invalid", validator.isValidInet6Address("::ffff:192x168.1.26")); // ditto
    251         assertTrue("IPV6 ::ffff:192.168.1.1 should be valid", validator.isValidInet6Address("::ffff:192.168.1.1"));
    252         assertTrue("IPV6 0:0:0:0:0:0:13.1.68.3 should be valid", validator.isValidInet6Address("0:0:0:0:0:0:13.1.68.3")); // IPv4-compatible IPv6 address, full, deprecated
    253         assertTrue("IPV6 0:0:0:0:0:FFFF:129.144.52.38 should be valid", validator.isValidInet6Address("0:0:0:0:0:FFFF:129.144.52.38")); // IPv4-mapped IPv6 address, full
    254         assertTrue("IPV6 ::13.1.68.3 should be valid", validator.isValidInet6Address("::13.1.68.3")); // IPv4-compatible IPv6 address, compressed, deprecated
    255         assertTrue("IPV6 ::FFFF:129.144.52.38 should be valid", validator.isValidInet6Address("::FFFF:129.144.52.38")); // IPv4-mapped IPv6 address, compressed
    256         assertTrue("IPV6 fe80:0:0:0:204:61ff:254.157.241.86 should be valid", validator.isValidInet6Address("fe80:0:0:0:204:61ff:254.157.241.86"));
    257         assertTrue("IPV6 fe80::204:61ff:254.157.241.86 should be valid", validator.isValidInet6Address("fe80::204:61ff:254.157.241.86"));
    258         assertTrue("IPV6 ::ffff:12.34.56.78 should be valid", validator.isValidInet6Address("::ffff:12.34.56.78"));
    259         assertFalse("IPV6 ::ffff:2.3.4 should be invalid", validator.isValidInet6Address("::ffff:2.3.4"));
    260         assertFalse("IPV6 ::ffff:257.1.2.3 should be invalid", validator.isValidInet6Address("::ffff:257.1.2.3"));
    261         assertFalse("IPV6 1.2.3.4 should be invalid", validator.isValidInet6Address("1.2.3.4"));
    262         assertFalse("IPV6 1.2.3.4:1111:2222:3333:4444::5555 should be invalid", validator.isValidInet6Address("1.2.3.4:1111:2222:3333:4444::5555"));
    263         assertFalse("IPV6 1.2.3.4:1111:2222:3333::5555 should be invalid", validator.isValidInet6Address("1.2.3.4:1111:2222:3333::5555"));
    264         assertFalse("IPV6 1.2.3.4:1111:2222::5555 should be invalid", validator.isValidInet6Address("1.2.3.4:1111:2222::5555"));
    265         assertFalse("IPV6 1.2.3.4:1111::5555 should be invalid", validator.isValidInet6Address("1.2.3.4:1111::5555"));
    266         assertFalse("IPV6 1.2.3.4::5555 should be invalid", validator.isValidInet6Address("1.2.3.4::5555"));
    267         assertFalse("IPV6 1.2.3.4:: should be invalid", validator.isValidInet6Address("1.2.3.4::"));
     187        assertTrue(validator.isValidInet6Address("1:2:3:4:5:6:1.2.3.4"), "IPV6 1:2:3:4:5:6:1.2.3.4 should be valid");
     188        assertTrue(validator.isValidInet6Address("1:2:3:4:5::1.2.3.4"), "IPV6 1:2:3:4:5::1.2.3.4 should be valid");
     189        assertTrue(validator.isValidInet6Address("1:2:3:4::1.2.3.4"), "IPV6 1:2:3:4::1.2.3.4 should be valid");
     190        assertTrue(validator.isValidInet6Address("1:2:3::1.2.3.4"), "IPV6 1:2:3::1.2.3.4 should be valid");
     191        assertTrue(validator.isValidInet6Address("1:2::1.2.3.4"), "IPV6 1:2::1.2.3.4 should be valid");
     192        assertTrue(validator.isValidInet6Address("1::1.2.3.4"), "IPV6 1::1.2.3.4 should be valid");
     193        assertTrue(validator.isValidInet6Address("1:2:3:4::5:1.2.3.4"), "IPV6 1:2:3:4::5:1.2.3.4 should be valid");
     194        assertTrue(validator.isValidInet6Address("1:2:3::5:1.2.3.4"), "IPV6 1:2:3::5:1.2.3.4 should be valid");
     195        assertTrue(validator.isValidInet6Address("1:2::5:1.2.3.4"), "IPV6 1:2::5:1.2.3.4 should be valid");
     196        assertTrue(validator.isValidInet6Address("1::5:1.2.3.4"), "IPV6 1::5:1.2.3.4 should be valid");
     197        assertTrue(validator.isValidInet6Address("1::5:11.22.33.44"), "IPV6 1::5:11.22.33.44 should be valid");
     198        assertFalse(validator.isValidInet6Address("1::5:400.2.3.4"), "IPV6 1::5:400.2.3.4 should be invalid");
     199        assertFalse(validator.isValidInet6Address("1::5:260.2.3.4"), "IPV6 1::5:260.2.3.4 should be invalid");
     200        assertFalse(validator.isValidInet6Address("1::5:256.2.3.4"), "IPV6 1::5:256.2.3.4 should be invalid");
     201        assertFalse(validator.isValidInet6Address("1::5:1.256.3.4"), "IPV6 1::5:1.256.3.4 should be invalid");
     202        assertFalse(validator.isValidInet6Address("1::5:1.2.256.4"), "IPV6 1::5:1.2.256.4 should be invalid");
     203        assertFalse(validator.isValidInet6Address("1::5:1.2.3.256"), "IPV6 1::5:1.2.3.256 should be invalid");
     204        assertFalse(validator.isValidInet6Address("1::5:300.2.3.4"), "IPV6 1::5:300.2.3.4 should be invalid");
     205        assertFalse(validator.isValidInet6Address("1::5:1.300.3.4"), "IPV6 1::5:1.300.3.4 should be invalid");
     206        assertFalse(validator.isValidInet6Address("1::5:1.2.300.4"), "IPV6 1::5:1.2.300.4 should be invalid");
     207        assertFalse(validator.isValidInet6Address("1::5:1.2.3.300"), "IPV6 1::5:1.2.3.300 should be invalid");
     208        assertFalse(validator.isValidInet6Address("1::5:900.2.3.4"), "IPV6 1::5:900.2.3.4 should be invalid");
     209        assertFalse(validator.isValidInet6Address("1::5:1.900.3.4"), "IPV6 1::5:1.900.3.4 should be invalid");
     210        assertFalse(validator.isValidInet6Address("1::5:1.2.900.4"), "IPV6 1::5:1.2.900.4 should be invalid");
     211        assertFalse(validator.isValidInet6Address("1::5:1.2.3.900"), "IPV6 1::5:1.2.3.900 should be invalid");
     212        assertFalse(validator.isValidInet6Address("1::5:300.300.300.300"), "IPV6 1::5:300.300.300.300 should be invalid");
     213        assertFalse(validator.isValidInet6Address("1::5:3000.30.30.30"), "IPV6 1::5:3000.30.30.30 should be invalid");
     214        assertFalse(validator.isValidInet6Address("1::400.2.3.4"), "IPV6 1::400.2.3.4 should be invalid");
     215        assertFalse(validator.isValidInet6Address("1::260.2.3.4"), "IPV6 1::260.2.3.4 should be invalid");
     216        assertFalse(validator.isValidInet6Address("1::256.2.3.4"), "IPV6 1::256.2.3.4 should be invalid");
     217        assertFalse(validator.isValidInet6Address("1::1.256.3.4"), "IPV6 1::1.256.3.4 should be invalid");
     218        assertFalse(validator.isValidInet6Address("1::1.2.256.4"), "IPV6 1::1.2.256.4 should be invalid");
     219        assertFalse(validator.isValidInet6Address("1::1.2.3.256"), "IPV6 1::1.2.3.256 should be invalid");
     220        assertFalse(validator.isValidInet6Address("1::300.2.3.4"), "IPV6 1::300.2.3.4 should be invalid");
     221        assertFalse(validator.isValidInet6Address("1::1.300.3.4"), "IPV6 1::1.300.3.4 should be invalid");
     222        assertFalse(validator.isValidInet6Address("1::1.2.300.4"), "IPV6 1::1.2.300.4 should be invalid");
     223        assertFalse(validator.isValidInet6Address("1::1.2.3.300"), "IPV6 1::1.2.3.300 should be invalid");
     224        assertFalse(validator.isValidInet6Address("1::900.2.3.4"), "IPV6 1::900.2.3.4 should be invalid");
     225        assertFalse(validator.isValidInet6Address("1::1.900.3.4"), "IPV6 1::1.900.3.4 should be invalid");
     226        assertFalse(validator.isValidInet6Address("1::1.2.900.4"), "IPV6 1::1.2.900.4 should be invalid");
     227        assertFalse(validator.isValidInet6Address("1::1.2.3.900"), "IPV6 1::1.2.3.900 should be invalid");
     228        assertFalse(validator.isValidInet6Address("1::300.300.300.300"), "IPV6 1::300.300.300.300 should be invalid");
     229        assertFalse(validator.isValidInet6Address("1::3000.30.30.30"), "IPV6 1::3000.30.30.30 should be invalid");
     230        assertFalse(validator.isValidInet6Address("::400.2.3.4"), "IPV6 ::400.2.3.4 should be invalid");
     231        assertFalse(validator.isValidInet6Address("::260.2.3.4"), "IPV6 ::260.2.3.4 should be invalid");
     232        assertFalse(validator.isValidInet6Address("::256.2.3.4"), "IPV6 ::256.2.3.4 should be invalid");
     233        assertFalse(validator.isValidInet6Address("::1.256.3.4"), "IPV6 ::1.256.3.4 should be invalid");
     234        assertFalse(validator.isValidInet6Address("::1.2.256.4"), "IPV6 ::1.2.256.4 should be invalid");
     235        assertFalse(validator.isValidInet6Address("::1.2.3.256"), "IPV6 ::1.2.3.256 should be invalid");
     236        assertFalse(validator.isValidInet6Address("::300.2.3.4"), "IPV6 ::300.2.3.4 should be invalid");
     237        assertFalse(validator.isValidInet6Address("::1.300.3.4"), "IPV6 ::1.300.3.4 should be invalid");
     238        assertFalse(validator.isValidInet6Address("::1.2.300.4"), "IPV6 ::1.2.300.4 should be invalid");
     239        assertFalse(validator.isValidInet6Address("::1.2.3.300"), "IPV6 ::1.2.3.300 should be invalid");
     240        assertFalse(validator.isValidInet6Address("::900.2.3.4"), "IPV6 ::900.2.3.4 should be invalid");
     241        assertFalse(validator.isValidInet6Address("::1.900.3.4"), "IPV6 ::1.900.3.4 should be invalid");
     242        assertFalse(validator.isValidInet6Address("::1.2.900.4"), "IPV6 ::1.2.900.4 should be invalid");
     243        assertFalse(validator.isValidInet6Address("::1.2.3.900"), "IPV6 ::1.2.3.900 should be invalid");
     244        assertFalse(validator.isValidInet6Address("::300.300.300.300"), "IPV6 ::300.300.300.300 should be invalid");
     245        assertFalse(validator.isValidInet6Address("::3000.30.30.30"), "IPV6 ::3000.30.30.30 should be invalid");
     246        assertTrue(validator.isValidInet6Address("fe80::217:f2ff:254.7.237.98"), "IPV6 fe80::217:f2ff:254.7.237.98 should be valid");
     247        assertTrue(validator.isValidInet6Address("::ffff:192.168.1.26"), "IPV6 ::ffff:192.168.1.26 should be valid");
     248        assertFalse(validator.isValidInet6Address("2001:1:1:1:1:1:255Z255X255Y255"), "IPV6 2001:1:1:1:1:1:255Z255X255Y255 should be invalid"); // garbage instead of "." in IPv4
     249        assertFalse(validator.isValidInet6Address("::ffff:192x168.1.26"), "IPV6 ::ffff:192x168.1.26 should be invalid"); // ditto
     250        assertTrue(validator.isValidInet6Address("::ffff:192.168.1.1"), "IPV6 ::ffff:192.168.1.1 should be valid");
     251        assertTrue(validator.isValidInet6Address("0:0:0:0:0:0:13.1.68.3"), "IPV6 0:0:0:0:0:0:13.1.68.3 should be valid"); // IPv4-compatible IPv6 address, full, deprecated
     252        assertTrue(validator.isValidInet6Address("0:0:0:0:0:FFFF:129.144.52.38"), "IPV6 0:0:0:0:0:FFFF:129.144.52.38 should be valid"); // IPv4-mapped IPv6 address, full
     253        assertTrue(validator.isValidInet6Address("::13.1.68.3"), "IPV6 ::13.1.68.3 should be valid"); // IPv4-compatible IPv6 address, compressed, deprecated
     254        assertTrue(validator.isValidInet6Address("::FFFF:129.144.52.38"), "IPV6 ::FFFF:129.144.52.38 should be valid"); // IPv4-mapped IPv6 address, compressed
     255        assertTrue(validator.isValidInet6Address("fe80:0:0:0:204:61ff:254.157.241.86"), "IPV6 fe80:0:0:0:204:61ff:254.157.241.86 should be valid");
     256        assertTrue(validator.isValidInet6Address("fe80::204:61ff:254.157.241.86"), "IPV6 fe80::204:61ff:254.157.241.86 should be valid");
     257        assertTrue(validator.isValidInet6Address("::ffff:12.34.56.78"), "IPV6 ::ffff:12.34.56.78 should be valid");
     258        assertFalse(validator.isValidInet6Address("::ffff:2.3.4"), "IPV6 ::ffff:2.3.4 should be invalid");
     259        assertFalse(validator.isValidInet6Address("::ffff:257.1.2.3"), "IPV6 ::ffff:257.1.2.3 should be invalid");
     260        assertFalse(validator.isValidInet6Address("1.2.3.4"), "IPV6 1.2.3.4 should be invalid");
     261        assertFalse(validator.isValidInet6Address("1.2.3.4:1111:2222:3333:4444::5555"), "IPV6 1.2.3.4:1111:2222:3333:4444::5555 should be invalid");
     262        assertFalse(validator.isValidInet6Address("1.2.3.4:1111:2222:3333::5555"), "IPV6 1.2.3.4:1111:2222:3333::5555 should be invalid");
     263        assertFalse(validator.isValidInet6Address("1.2.3.4:1111:2222::5555"), "IPV6 1.2.3.4:1111:2222::5555 should be invalid");
     264        assertFalse(validator.isValidInet6Address("1.2.3.4:1111::5555"), "IPV6 1.2.3.4:1111::5555 should be invalid");
     265        assertFalse(validator.isValidInet6Address("1.2.3.4::5555"), "IPV6 1.2.3.4::5555 should be invalid");
     266        assertFalse(validator.isValidInet6Address("1.2.3.4::"), "IPV6 1.2.3.4:: should be invalid");
    268267        // Testing IPv4 addresses represented as dotted-quads
    269268        // Leading zeroes in IPv4 addresses not allowed: some systems treat the leading "0" in ".086" as the start of an octal number
    270269        // Update: The BNF in RFC-3986 explicitly defines the dec-octet (for IPv4 addresses) not to have a leading zero
    271         assertFalse("IPV6 fe80:0000:0000:0000:0204:61ff:254.157.241.086 should be invalid", validator.isValidInet6Address("fe80:0000:0000:0000:0204:61ff:254.157.241.086"));
    272         assertTrue("IPV6 ::ffff:192.0.2.128 should be valid", validator.isValidInet6Address("::ffff:192.0.2.128")); // but this is OK, since there's a single digit
    273         assertFalse("IPV6 XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:1.2.3.4 should be invalid", validator.isValidInet6Address("XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:1.2.3.4"));
    274         assertFalse("IPV6 1111:2222:3333:4444:5555:6666:00.00.00.00 should be invalid", validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:00.00.00.00"));
    275         assertFalse("IPV6 1111:2222:3333:4444:5555:6666:000.000.000.000 should be invalid", validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:000.000.000.000"));
    276         assertFalse("IPV6 1111:2222:3333:4444:5555:6666:256.256.256.256 should be invalid", validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:256.256.256.256"));
    277         assertTrue("IPV6 fe80:0000:0000:0000:0204:61ff:fe9d:f156 should be valid", validator.isValidInet6Address("fe80:0000:0000:0000:0204:61ff:fe9d:f156"));
    278         assertTrue("IPV6 fe80:0:0:0:204:61ff:fe9d:f156 should be valid", validator.isValidInet6Address("fe80:0:0:0:204:61ff:fe9d:f156"));
    279         assertTrue("IPV6 fe80::204:61ff:fe9d:f156 should be valid", validator.isValidInet6Address("fe80::204:61ff:fe9d:f156"));
    280         assertFalse("IPV6 : should be invalid", validator.isValidInet6Address(":"));
    281         assertTrue("IPV6 ::ffff:c000:280 should be valid", validator.isValidInet6Address("::ffff:c000:280"));
    282         assertFalse("IPV6 1111:2222:3333:4444::5555: should be invalid", validator.isValidInet6Address("1111:2222:3333:4444::5555:"));
    283         assertFalse("IPV6 1111:2222:3333::5555: should be invalid", validator.isValidInet6Address("1111:2222:3333::5555:"));
    284         assertFalse("IPV6 1111:2222::5555: should be invalid", validator.isValidInet6Address("1111:2222::5555:"));
    285         assertFalse("IPV6 1111::5555: should be invalid", validator.isValidInet6Address("1111::5555:"));
    286         assertFalse("IPV6 ::5555: should be invalid", validator.isValidInet6Address("::5555:"));
    287         assertFalse("IPV6 ::: should be invalid", validator.isValidInet6Address(":::"));
    288         assertFalse("IPV6 1111: should be invalid", validator.isValidInet6Address("1111:"));
    289         assertFalse("IPV6 :1111:2222:3333:4444::5555 should be invalid", validator.isValidInet6Address(":1111:2222:3333:4444::5555"));
    290         assertFalse("IPV6 :1111:2222:3333::5555 should be invalid", validator.isValidInet6Address(":1111:2222:3333::5555"));
    291         assertFalse("IPV6 :1111:2222::5555 should be invalid", validator.isValidInet6Address(":1111:2222::5555"));
    292         assertFalse("IPV6 :1111::5555 should be invalid", validator.isValidInet6Address(":1111::5555"));
    293         assertFalse("IPV6 :::5555 should be invalid", validator.isValidInet6Address(":::5555"));
    294         assertTrue("IPV6 2001:0db8:85a3:0000:0000:8a2e:0370:7334 should be valid", validator.isValidInet6Address("2001:0db8:85a3:0000:0000:8a2e:0370:7334"));
    295         assertTrue("IPV6 2001:db8:85a3:0:0:8a2e:370:7334 should be valid", validator.isValidInet6Address("2001:db8:85a3:0:0:8a2e:370:7334"));
    296         assertTrue("IPV6 2001:db8:85a3::8a2e:370:7334 should be valid", validator.isValidInet6Address("2001:db8:85a3::8a2e:370:7334"));
    297         assertTrue("IPV6 2001:0db8:0000:0000:0000:0000:1428:57ab should be valid", validator.isValidInet6Address("2001:0db8:0000:0000:0000:0000:1428:57ab"));
    298         assertTrue("IPV6 2001:0db8:0000:0000:0000::1428:57ab should be valid", validator.isValidInet6Address("2001:0db8:0000:0000:0000::1428:57ab"));
    299         assertTrue("IPV6 2001:0db8:0:0:0:0:1428:57ab should be valid", validator.isValidInet6Address("2001:0db8:0:0:0:0:1428:57ab"));
    300         assertTrue("IPV6 2001:0db8:0:0::1428:57ab should be valid", validator.isValidInet6Address("2001:0db8:0:0::1428:57ab"));
    301         assertTrue("IPV6 2001:0db8::1428:57ab should be valid", validator.isValidInet6Address("2001:0db8::1428:57ab"));
    302         assertTrue("IPV6 2001:db8::1428:57ab should be valid", validator.isValidInet6Address("2001:db8::1428:57ab"));
    303         assertTrue("IPV6 ::ffff:0c22:384e should be valid", validator.isValidInet6Address("::ffff:0c22:384e"));
    304         assertTrue("IPV6 2001:0db8:1234:0000:0000:0000:0000:0000 should be valid", validator.isValidInet6Address("2001:0db8:1234:0000:0000:0000:0000:0000"));
    305         assertTrue("IPV6 2001:0db8:1234:ffff:ffff:ffff:ffff:ffff should be valid", validator.isValidInet6Address("2001:0db8:1234:ffff:ffff:ffff:ffff:ffff"));
    306         assertTrue("IPV6 2001:db8:a::123 should be valid", validator.isValidInet6Address("2001:db8:a::123"));
    307         assertFalse("IPV6 123 should be invalid", validator.isValidInet6Address("123"));
    308         assertFalse("IPV6 ldkfj should be invalid", validator.isValidInet6Address("ldkfj"));
    309         assertFalse("IPV6 2001::FFD3::57ab should be invalid", validator.isValidInet6Address("2001::FFD3::57ab"));
    310         assertFalse("IPV6 2001:db8:85a3::8a2e:37023:7334 should be invalid", validator.isValidInet6Address("2001:db8:85a3::8a2e:37023:7334"));
    311         assertFalse("IPV6 2001:db8:85a3::8a2e:370k:7334 should be invalid", validator.isValidInet6Address("2001:db8:85a3::8a2e:370k:7334"));
    312         assertFalse("IPV6 1:2:3:4:5:6:7:8:9 should be invalid", validator.isValidInet6Address("1:2:3:4:5:6:7:8:9"));
    313         assertFalse("IPV6 1::2::3 should be invalid", validator.isValidInet6Address("1::2::3"));
    314         assertFalse("IPV6 1:::3:4:5 should be invalid", validator.isValidInet6Address("1:::3:4:5"));
    315         assertFalse("IPV6 1:2:3::4:5:6:7:8:9 should be invalid", validator.isValidInet6Address("1:2:3::4:5:6:7:8:9"));
    316         assertTrue("IPV6 1111:2222:3333:4444:5555:6666:7777:8888 should be valid", validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:7777:8888"));
    317         assertTrue("IPV6 1111:2222:3333:4444:5555:6666:7777:: should be valid", validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:7777::"));
    318         assertTrue("IPV6 1111:2222:3333:4444:5555:6666:: should be valid", validator.isValidInet6Address("1111:2222:3333:4444:5555:6666::"));
    319         assertTrue("IPV6 1111:2222:3333:4444:5555:: should be valid", validator.isValidInet6Address("1111:2222:3333:4444:5555::"));
    320         assertTrue("IPV6 1111:2222:3333:4444:: should be valid", validator.isValidInet6Address("1111:2222:3333:4444::"));
    321         assertTrue("IPV6 1111:2222:3333:: should be valid", validator.isValidInet6Address("1111:2222:3333::"));
    322         assertTrue("IPV6 1111:2222:: should be valid", validator.isValidInet6Address("1111:2222::"));
    323         assertTrue("IPV6 1111:: should be valid", validator.isValidInet6Address("1111::"));
    324         assertTrue("IPV6 1111:2222:3333:4444:5555:6666::8888 should be valid", validator.isValidInet6Address("1111:2222:3333:4444:5555:6666::8888"));
    325         assertTrue("IPV6 1111:2222:3333:4444:5555::8888 should be valid", validator.isValidInet6Address("1111:2222:3333:4444:5555::8888"));
    326         assertTrue("IPV6 1111:2222:3333:4444::8888 should be valid", validator.isValidInet6Address("1111:2222:3333:4444::8888"));
    327         assertTrue("IPV6 1111:2222:3333::8888 should be valid", validator.isValidInet6Address("1111:2222:3333::8888"));
    328         assertTrue("IPV6 1111:2222::8888 should be valid", validator.isValidInet6Address("1111:2222::8888"));
    329         assertTrue("IPV6 1111::8888 should be valid", validator.isValidInet6Address("1111::8888"));
    330         assertTrue("IPV6 ::8888 should be valid", validator.isValidInet6Address("::8888"));
    331         assertTrue("IPV6 1111:2222:3333:4444:5555::7777:8888 should be valid", validator.isValidInet6Address("1111:2222:3333:4444:5555::7777:8888"));
    332         assertTrue("IPV6 1111:2222:3333:4444::7777:8888 should be valid", validator.isValidInet6Address("1111:2222:3333:4444::7777:8888"));
    333         assertTrue("IPV6 1111:2222:3333::7777:8888 should be valid", validator.isValidInet6Address("1111:2222:3333::7777:8888"));
    334         assertTrue("IPV6 1111:2222::7777:8888 should be valid", validator.isValidInet6Address("1111:2222::7777:8888"));
    335         assertTrue("IPV6 1111::7777:8888 should be valid", validator.isValidInet6Address("1111::7777:8888"));
    336         assertTrue("IPV6 ::7777:8888 should be valid", validator.isValidInet6Address("::7777:8888"));
    337         assertTrue("IPV6 1111:2222:3333:4444::6666:7777:8888 should be valid", validator.isValidInet6Address("1111:2222:3333:4444::6666:7777:8888"));
    338         assertTrue("IPV6 1111:2222:3333::6666:7777:8888 should be valid", validator.isValidInet6Address("1111:2222:3333::6666:7777:8888"));
    339         assertTrue("IPV6 1111:2222::6666:7777:8888 should be valid", validator.isValidInet6Address("1111:2222::6666:7777:8888"));
    340         assertTrue("IPV6 1111::6666:7777:8888 should be valid", validator.isValidInet6Address("1111::6666:7777:8888"));
    341         assertTrue("IPV6 ::6666:7777:8888 should be valid", validator.isValidInet6Address("::6666:7777:8888"));
    342         assertTrue("IPV6 1111:2222:3333::5555:6666:7777:8888 should be valid", validator.isValidInet6Address("1111:2222:3333::5555:6666:7777:8888"));
    343         assertTrue("IPV6 1111:2222::5555:6666:7777:8888 should be valid", validator.isValidInet6Address("1111:2222::5555:6666:7777:8888"));
    344         assertTrue("IPV6 1111::5555:6666:7777:8888 should be valid", validator.isValidInet6Address("1111::5555:6666:7777:8888"));
    345         assertTrue("IPV6 ::5555:6666:7777:8888 should be valid", validator.isValidInet6Address("::5555:6666:7777:8888"));
    346         assertTrue("IPV6 1111:2222::4444:5555:6666:7777:8888 should be valid", validator.isValidInet6Address("1111:2222::4444:5555:6666:7777:8888"));
    347         assertTrue("IPV6 1111::4444:5555:6666:7777:8888 should be valid", validator.isValidInet6Address("1111::4444:5555:6666:7777:8888"));
    348         assertTrue("IPV6 ::4444:5555:6666:7777:8888 should be valid", validator.isValidInet6Address("::4444:5555:6666:7777:8888"));
    349         assertTrue("IPV6 1111::3333:4444:5555:6666:7777:8888 should be valid", validator.isValidInet6Address("1111::3333:4444:5555:6666:7777:8888"));
    350         assertTrue("IPV6 ::3333:4444:5555:6666:7777:8888 should be valid", validator.isValidInet6Address("::3333:4444:5555:6666:7777:8888"));
    351         assertTrue("IPV6 ::2222:3333:4444:5555:6666:7777:8888 should be valid", validator.isValidInet6Address("::2222:3333:4444:5555:6666:7777:8888"));
    352         assertTrue("IPV6 1111:2222:3333:4444:5555:6666:123.123.123.123 should be valid", validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:123.123.123.123"));
    353         assertTrue("IPV6 1111:2222:3333:4444:5555::123.123.123.123 should be valid", validator.isValidInet6Address("1111:2222:3333:4444:5555::123.123.123.123"));
    354         assertTrue("IPV6 1111:2222:3333:4444::123.123.123.123 should be valid", validator.isValidInet6Address("1111:2222:3333:4444::123.123.123.123"));
    355         assertTrue("IPV6 1111:2222:3333::123.123.123.123 should be valid", validator.isValidInet6Address("1111:2222:3333::123.123.123.123"));
    356         assertTrue("IPV6 1111:2222::123.123.123.123 should be valid", validator.isValidInet6Address("1111:2222::123.123.123.123"));
    357         assertTrue("IPV6 1111::123.123.123.123 should be valid", validator.isValidInet6Address("1111::123.123.123.123"));
    358         assertTrue("IPV6 ::123.123.123.123 should be valid", validator.isValidInet6Address("::123.123.123.123"));
    359         assertTrue("IPV6 1111:2222:3333:4444::6666:123.123.123.123 should be valid", validator.isValidInet6Address("1111:2222:3333:4444::6666:123.123.123.123"));
    360         assertTrue("IPV6 1111:2222:3333::6666:123.123.123.123 should be valid", validator.isValidInet6Address("1111:2222:3333::6666:123.123.123.123"));
    361         assertTrue("IPV6 1111:2222::6666:123.123.123.123 should be valid", validator.isValidInet6Address("1111:2222::6666:123.123.123.123"));
    362         assertTrue("IPV6 1111::6666:123.123.123.123 should be valid", validator.isValidInet6Address("1111::6666:123.123.123.123"));
    363         assertTrue("IPV6 ::6666:123.123.123.123 should be valid", validator.isValidInet6Address("::6666:123.123.123.123"));
    364         assertTrue("IPV6 1111:2222:3333::5555:6666:123.123.123.123 should be valid", validator.isValidInet6Address("1111:2222:3333::5555:6666:123.123.123.123"));
    365         assertTrue("IPV6 1111:2222::5555:6666:123.123.123.123 should be valid", validator.isValidInet6Address("1111:2222::5555:6666:123.123.123.123"));
    366         assertTrue("IPV6 1111::5555:6666:123.123.123.123 should be valid", validator.isValidInet6Address("1111::5555:6666:123.123.123.123"));
    367         assertTrue("IPV6 ::5555:6666:123.123.123.123 should be valid", validator.isValidInet6Address("::5555:6666:123.123.123.123"));
    368         assertTrue("IPV6 1111:2222::4444:5555:6666:123.123.123.123 should be valid", validator.isValidInet6Address("1111:2222::4444:5555:6666:123.123.123.123"));
    369         assertTrue("IPV6 1111::4444:5555:6666:123.123.123.123 should be valid", validator.isValidInet6Address("1111::4444:5555:6666:123.123.123.123"));
    370         assertTrue("IPV6 ::4444:5555:6666:123.123.123.123 should be valid", validator.isValidInet6Address("::4444:5555:6666:123.123.123.123"));
    371         assertTrue("IPV6 1111::3333:4444:5555:6666:123.123.123.123 should be valid", validator.isValidInet6Address("1111::3333:4444:5555:6666:123.123.123.123"));
    372         assertTrue("IPV6 ::2222:3333:4444:5555:6666:123.123.123.123 should be valid", validator.isValidInet6Address("::2222:3333:4444:5555:6666:123.123.123.123"));
     270        assertFalse(validator.isValidInet6Address("fe80:0000:0000:0000:0204:61ff:254.157.241.086"), "IPV6 fe80:0000:0000:0000:0204:61ff:254.157.241.086 should be invalid");
     271        assertTrue(validator.isValidInet6Address("::ffff:192.0.2.128"), "IPV6 ::ffff:192.0.2.128 should be valid"); // but this is OK, since there's a single digit
     272        assertFalse(validator.isValidInet6Address("XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:1.2.3.4"), "IPV6 XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:1.2.3.4 should be invalid");
     273        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:00.00.00.00"), "IPV6 1111:2222:3333:4444:5555:6666:00.00.00.00 should be invalid");
     274        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:000.000.000.000"), "IPV6 1111:2222:3333:4444:5555:6666:000.000.000.000 should be invalid");
     275        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:256.256.256.256"), "IPV6 1111:2222:3333:4444:5555:6666:256.256.256.256 should be invalid");
     276        assertTrue(validator.isValidInet6Address("fe80:0000:0000:0000:0204:61ff:fe9d:f156"), "IPV6 fe80:0000:0000:0000:0204:61ff:fe9d:f156 should be valid");
     277        assertTrue(validator.isValidInet6Address("fe80:0:0:0:204:61ff:fe9d:f156"), "IPV6 fe80:0:0:0:204:61ff:fe9d:f156 should be valid");
     278        assertTrue(validator.isValidInet6Address("fe80::204:61ff:fe9d:f156"), "IPV6 fe80::204:61ff:fe9d:f156 should be valid");
     279        assertFalse(validator.isValidInet6Address(":"), "IPV6 : should be invalid");
     280        assertTrue(validator.isValidInet6Address("::ffff:c000:280"), "IPV6 ::ffff:c000:280 should be valid");
     281        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444::5555:"), "IPV6 1111:2222:3333:4444::5555: should be invalid");
     282        assertFalse(validator.isValidInet6Address("1111:2222:3333::5555:"), "IPV6 1111:2222:3333::5555: should be invalid");
     283        assertFalse(validator.isValidInet6Address("1111:2222::5555:"), "IPV6 1111:2222::5555: should be invalid");
     284        assertFalse(validator.isValidInet6Address("1111::5555:"), "IPV6 1111::5555: should be invalid");
     285        assertFalse(validator.isValidInet6Address("::5555:"), "IPV6 ::5555: should be invalid");
     286        assertFalse(validator.isValidInet6Address(":::"), "IPV6 ::: should be invalid");
     287        assertFalse(validator.isValidInet6Address("1111:"), "IPV6 1111: should be invalid");
     288        assertFalse(validator.isValidInet6Address(":1111:2222:3333:4444::5555"), "IPV6 :1111:2222:3333:4444::5555 should be invalid");
     289        assertFalse(validator.isValidInet6Address(":1111:2222:3333::5555"), "IPV6 :1111:2222:3333::5555 should be invalid");
     290        assertFalse(validator.isValidInet6Address(":1111:2222::5555"), "IPV6 :1111:2222::5555 should be invalid");
     291        assertFalse(validator.isValidInet6Address(":1111::5555"), "IPV6 :1111::5555 should be invalid");
     292        assertFalse(validator.isValidInet6Address(":::5555"), "IPV6 :::5555 should be invalid");
     293        assertTrue(validator.isValidInet6Address("2001:0db8:85a3:0000:0000:8a2e:0370:7334"), "IPV6 2001:0db8:85a3:0000:0000:8a2e:0370:7334 should be valid");
     294        assertTrue(validator.isValidInet6Address("2001:db8:85a3:0:0:8a2e:370:7334"), "IPV6 2001:db8:85a3:0:0:8a2e:370:7334 should be valid");
     295        assertTrue(validator.isValidInet6Address("2001:db8:85a3::8a2e:370:7334"), "IPV6 2001:db8:85a3::8a2e:370:7334 should be valid");
     296        assertTrue(validator.isValidInet6Address("2001:0db8:0000:0000:0000:0000:1428:57ab"), "IPV6 2001:0db8:0000:0000:0000:0000:1428:57ab should be valid");
     297        assertTrue(validator.isValidInet6Address("2001:0db8:0000:0000:0000::1428:57ab"), "IPV6 2001:0db8:0000:0000:0000::1428:57ab should be valid");
     298        assertTrue(validator.isValidInet6Address("2001:0db8:0:0:0:0:1428:57ab"), "IPV6 2001:0db8:0:0:0:0:1428:57ab should be valid");
     299        assertTrue(validator.isValidInet6Address("2001:0db8:0:0::1428:57ab"), "IPV6 2001:0db8:0:0::1428:57ab should be valid");
     300        assertTrue(validator.isValidInet6Address("2001:0db8::1428:57ab"), "IPV6 2001:0db8::1428:57ab should be valid");
     301        assertTrue(validator.isValidInet6Address("2001:db8::1428:57ab"), "IPV6 2001:db8::1428:57ab should be valid");
     302        assertTrue(validator.isValidInet6Address("::ffff:0c22:384e"), "IPV6 ::ffff:0c22:384e should be valid");
     303        assertTrue(validator.isValidInet6Address("2001:0db8:1234:0000:0000:0000:0000:0000"), "IPV6 2001:0db8:1234:0000:0000:0000:0000:0000 should be valid");
     304        assertTrue(validator.isValidInet6Address("2001:0db8:1234:ffff:ffff:ffff:ffff:ffff"), "IPV6 2001:0db8:1234:ffff:ffff:ffff:ffff:ffff should be valid");
     305        assertTrue(validator.isValidInet6Address("2001:db8:a::123"), "IPV6 2001:db8:a::123 should be valid");
     306        assertFalse(validator.isValidInet6Address("123"), "IPV6 123 should be invalid");
     307        assertFalse(validator.isValidInet6Address("ldkfj"), "IPV6 ldkfj should be invalid");
     308        assertFalse(validator.isValidInet6Address("2001::FFD3::57ab"), "IPV6 2001::FFD3::57ab should be invalid");
     309        assertFalse(validator.isValidInet6Address("2001:db8:85a3::8a2e:37023:7334"), "IPV6 2001:db8:85a3::8a2e:37023:7334 should be invalid");
     310        assertFalse(validator.isValidInet6Address("2001:db8:85a3::8a2e:370k:7334"), "IPV6 2001:db8:85a3::8a2e:370k:7334 should be invalid");
     311        assertFalse(validator.isValidInet6Address("1:2:3:4:5:6:7:8:9"), "IPV6 1:2:3:4:5:6:7:8:9 should be invalid");
     312        assertFalse(validator.isValidInet6Address("1::2::3"), "IPV6 1::2::3 should be invalid");
     313        assertFalse(validator.isValidInet6Address("1:::3:4:5"), "IPV6 1:::3:4:5 should be invalid");
     314        assertFalse(validator.isValidInet6Address("1:2:3::4:5:6:7:8:9"), "IPV6 1:2:3::4:5:6:7:8:9 should be invalid");
     315        assertTrue(validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:7777:8888"), "IPV6 1111:2222:3333:4444:5555:6666:7777:8888 should be valid");
     316        assertTrue(validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:7777::"), "IPV6 1111:2222:3333:4444:5555:6666:7777:: should be valid");
     317        assertTrue(validator.isValidInet6Address("1111:2222:3333:4444:5555:6666::"), "IPV6 1111:2222:3333:4444:5555:6666:: should be valid");
     318        assertTrue(validator.isValidInet6Address("1111:2222:3333:4444:5555::"), "IPV6 1111:2222:3333:4444:5555:: should be valid");
     319        assertTrue(validator.isValidInet6Address("1111:2222:3333:4444::"), "IPV6 1111:2222:3333:4444:: should be valid");
     320        assertTrue(validator.isValidInet6Address("1111:2222:3333::"), "IPV6 1111:2222:3333:: should be valid");
     321        assertTrue(validator.isValidInet6Address("1111:2222::"), "IPV6 1111:2222:: should be valid");
     322        assertTrue(validator.isValidInet6Address("1111::"), "IPV6 1111:: should be valid");
     323        assertTrue(validator.isValidInet6Address("1111:2222:3333:4444:5555:6666::8888"), "IPV6 1111:2222:3333:4444:5555:6666::8888 should be valid");
     324        assertTrue(validator.isValidInet6Address("1111:2222:3333:4444:5555::8888"), "IPV6 1111:2222:3333:4444:5555::8888 should be valid");
     325        assertTrue(validator.isValidInet6Address("1111:2222:3333:4444::8888"), "IPV6 1111:2222:3333:4444::8888 should be valid");
     326        assertTrue(validator.isValidInet6Address("1111:2222:3333::8888"), "IPV6 1111:2222:3333::8888 should be valid");
     327        assertTrue(validator.isValidInet6Address("1111:2222::8888"), "IPV6 1111:2222::8888 should be valid");
     328        assertTrue(validator.isValidInet6Address("1111::8888"), "IPV6 1111::8888 should be valid");
     329        assertTrue(validator.isValidInet6Address("::8888"), "IPV6 ::8888 should be valid");
     330        assertTrue(validator.isValidInet6Address("1111:2222:3333:4444:5555::7777:8888"), "IPV6 1111:2222:3333:4444:5555::7777:8888 should be valid");
     331        assertTrue(validator.isValidInet6Address("1111:2222:3333:4444::7777:8888"), "IPV6 1111:2222:3333:4444::7777:8888 should be valid");
     332        assertTrue(validator.isValidInet6Address("1111:2222:3333::7777:8888"), "IPV6 1111:2222:3333::7777:8888 should be valid");
     333        assertTrue(validator.isValidInet6Address("1111:2222::7777:8888"), "IPV6 1111:2222::7777:8888 should be valid");
     334        assertTrue(validator.isValidInet6Address("1111::7777:8888"), "IPV6 1111::7777:8888 should be valid");
     335        assertTrue(validator.isValidInet6Address("::7777:8888"), "IPV6 ::7777:8888 should be valid");
     336        assertTrue(validator.isValidInet6Address("1111:2222:3333:4444::6666:7777:8888"), "IPV6 1111:2222:3333:4444::6666:7777:8888 should be valid");
     337        assertTrue(validator.isValidInet6Address("1111:2222:3333::6666:7777:8888"), "IPV6 1111:2222:3333::6666:7777:8888 should be valid");
     338        assertTrue(validator.isValidInet6Address("1111:2222::6666:7777:8888"), "IPV6 1111:2222::6666:7777:8888 should be valid");
     339        assertTrue(validator.isValidInet6Address("1111::6666:7777:8888"), "IPV6 1111::6666:7777:8888 should be valid");
     340        assertTrue(validator.isValidInet6Address("::6666:7777:8888"), "IPV6 ::6666:7777:8888 should be valid");
     341        assertTrue(validator.isValidInet6Address("1111:2222:3333::5555:6666:7777:8888"), "IPV6 1111:2222:3333::5555:6666:7777:8888 should be valid");
     342        assertTrue(validator.isValidInet6Address("1111:2222::5555:6666:7777:8888"), "IPV6 1111:2222::5555:6666:7777:8888 should be valid");
     343        assertTrue(validator.isValidInet6Address("1111::5555:6666:7777:8888"), "IPV6 1111::5555:6666:7777:8888 should be valid");
     344        assertTrue(validator.isValidInet6Address("::5555:6666:7777:8888"), "IPV6 ::5555:6666:7777:8888 should be valid");
     345        assertTrue(validator.isValidInet6Address("1111:2222::4444:5555:6666:7777:8888"), "IPV6 1111:2222::4444:5555:6666:7777:8888 should be valid");
     346        assertTrue(validator.isValidInet6Address("1111::4444:5555:6666:7777:8888"), "IPV6 1111::4444:5555:6666:7777:8888 should be valid");
     347        assertTrue(validator.isValidInet6Address("::4444:5555:6666:7777:8888"), "IPV6 ::4444:5555:6666:7777:8888 should be valid");
     348        assertTrue(validator.isValidInet6Address("1111::3333:4444:5555:6666:7777:8888"), "IPV6 1111::3333:4444:5555:6666:7777:8888 should be valid");
     349        assertTrue(validator.isValidInet6Address("::3333:4444:5555:6666:7777:8888"), "IPV6 ::3333:4444:5555:6666:7777:8888 should be valid");
     350        assertTrue(validator.isValidInet6Address("::2222:3333:4444:5555:6666:7777:8888"), "IPV6 ::2222:3333:4444:5555:6666:7777:8888 should be valid");
     351        assertTrue(validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:123.123.123.123"), "IPV6 1111:2222:3333:4444:5555:6666:123.123.123.123 should be valid");
     352        assertTrue(validator.isValidInet6Address("1111:2222:3333:4444:5555::123.123.123.123"), "IPV6 1111:2222:3333:4444:5555::123.123.123.123 should be valid");
     353        assertTrue(validator.isValidInet6Address("1111:2222:3333:4444::123.123.123.123"), "IPV6 1111:2222:3333:4444::123.123.123.123 should be valid");
     354        assertTrue(validator.isValidInet6Address("1111:2222:3333::123.123.123.123"), "IPV6 1111:2222:3333::123.123.123.123 should be valid");
     355        assertTrue(validator.isValidInet6Address("1111:2222::123.123.123.123"), "IPV6 1111:2222::123.123.123.123 should be valid");
     356        assertTrue(validator.isValidInet6Address("1111::123.123.123.123"), "IPV6 1111::123.123.123.123 should be valid");
     357        assertTrue(validator.isValidInet6Address("::123.123.123.123"), "IPV6 ::123.123.123.123 should be valid");
     358        assertTrue(validator.isValidInet6Address("1111:2222:3333:4444::6666:123.123.123.123"), "IPV6 1111:2222:3333:4444::6666:123.123.123.123 should be valid");
     359        assertTrue(validator.isValidInet6Address("1111:2222:3333::6666:123.123.123.123"), "IPV6 1111:2222:3333::6666:123.123.123.123 should be valid");
     360        assertTrue(validator.isValidInet6Address("1111:2222::6666:123.123.123.123"), "IPV6 1111:2222::6666:123.123.123.123 should be valid");
     361        assertTrue(validator.isValidInet6Address("1111::6666:123.123.123.123"), "IPV6 1111::6666:123.123.123.123 should be valid");
     362        assertTrue(validator.isValidInet6Address("::6666:123.123.123.123"), "IPV6 ::6666:123.123.123.123 should be valid");
     363        assertTrue(validator.isValidInet6Address("1111:2222:3333::5555:6666:123.123.123.123"), "IPV6 1111:2222:3333::5555:6666:123.123.123.123 should be valid");
     364        assertTrue(validator.isValidInet6Address("1111:2222::5555:6666:123.123.123.123"), "IPV6 1111:2222::5555:6666:123.123.123.123 should be valid");
     365        assertTrue(validator.isValidInet6Address("1111::5555:6666:123.123.123.123"), "IPV6 1111::5555:6666:123.123.123.123 should be valid");
     366        assertTrue(validator.isValidInet6Address("::5555:6666:123.123.123.123"), "IPV6 ::5555:6666:123.123.123.123 should be valid");
     367        assertTrue(validator.isValidInet6Address("1111:2222::4444:5555:6666:123.123.123.123"), "IPV6 1111:2222::4444:5555:6666:123.123.123.123 should be valid");
     368        assertTrue(validator.isValidInet6Address("1111::4444:5555:6666:123.123.123.123"), "IPV6 1111::4444:5555:6666:123.123.123.123 should be valid");
     369        assertTrue(validator.isValidInet6Address("::4444:5555:6666:123.123.123.123"), "IPV6 ::4444:5555:6666:123.123.123.123 should be valid");
     370        assertTrue(validator.isValidInet6Address("1111::3333:4444:5555:6666:123.123.123.123"), "IPV6 1111::3333:4444:5555:6666:123.123.123.123 should be valid");
     371        assertTrue(validator.isValidInet6Address("::2222:3333:4444:5555:6666:123.123.123.123"), "IPV6 ::2222:3333:4444:5555:6666:123.123.123.123 should be valid");
    373372        // Trying combinations of "0" and "::"
    374373        // These are all syntactically correct, but are bad form
    375374        // because "0" adjacent to "::" should be combined into "::"
    376         assertTrue("IPV6 ::0:0:0:0:0:0:0 should be valid", validator.isValidInet6Address("::0:0:0:0:0:0:0"));
    377         assertTrue("IPV6 ::0:0:0:0:0:0 should be valid", validator.isValidInet6Address("::0:0:0:0:0:0"));
    378         assertTrue("IPV6 ::0:0:0:0:0 should be valid", validator.isValidInet6Address("::0:0:0:0:0"));
    379         assertTrue("IPV6 ::0:0:0:0 should be valid", validator.isValidInet6Address("::0:0:0:0"));
    380         assertTrue("IPV6 ::0:0:0 should be valid", validator.isValidInet6Address("::0:0:0"));
    381         assertTrue("IPV6 ::0:0 should be valid", validator.isValidInet6Address("::0:0"));
    382         assertTrue("IPV6 ::0 should be valid", validator.isValidInet6Address("::0"));
    383         assertTrue("IPV6 0:0:0:0:0:0:0:: should be valid", validator.isValidInet6Address("0:0:0:0:0:0:0::"));
    384         assertTrue("IPV6 0:0:0:0:0:0:: should be valid", validator.isValidInet6Address("0:0:0:0:0:0::"));
    385         assertTrue("IPV6 0:0:0:0:0:: should be valid", validator.isValidInet6Address("0:0:0:0:0::"));
    386         assertTrue("IPV6 0:0:0:0:: should be valid", validator.isValidInet6Address("0:0:0:0::"));
    387         assertTrue("IPV6 0:0:0:: should be valid", validator.isValidInet6Address("0:0:0::"));
    388         assertTrue("IPV6 0:0:: should be valid", validator.isValidInet6Address("0:0::"));
    389         assertTrue("IPV6 0:: should be valid", validator.isValidInet6Address("0::"));
     375        assertTrue(validator.isValidInet6Address("::0:0:0:0:0:0:0"), "IPV6 ::0:0:0:0:0:0:0 should be valid");
     376        assertTrue(validator.isValidInet6Address("::0:0:0:0:0:0"), "IPV6 ::0:0:0:0:0:0 should be valid");
     377        assertTrue(validator.isValidInet6Address("::0:0:0:0:0"), "IPV6 ::0:0:0:0:0 should be valid");
     378        assertTrue(validator.isValidInet6Address("::0:0:0:0"), "IPV6 ::0:0:0:0 should be valid");
     379        assertTrue(validator.isValidInet6Address("::0:0:0"), "IPV6 ::0:0:0 should be valid");
     380        assertTrue(validator.isValidInet6Address("::0:0"), "IPV6 ::0:0 should be valid");
     381        assertTrue(validator.isValidInet6Address("::0"), "IPV6 ::0 should be valid");
     382        assertTrue(validator.isValidInet6Address("0:0:0:0:0:0:0::"), "IPV6 0:0:0:0:0:0:0:: should be valid");
     383        assertTrue(validator.isValidInet6Address("0:0:0:0:0:0::"), "IPV6 0:0:0:0:0:0:: should be valid");
     384        assertTrue(validator.isValidInet6Address("0:0:0:0:0::"), "IPV6 0:0:0:0:0:: should be valid");
     385        assertTrue(validator.isValidInet6Address("0:0:0:0::"), "IPV6 0:0:0:0:: should be valid");
     386        assertTrue(validator.isValidInet6Address("0:0:0::"), "IPV6 0:0:0:: should be valid");
     387        assertTrue(validator.isValidInet6Address("0:0::"), "IPV6 0:0:: should be valid");
     388        assertTrue(validator.isValidInet6Address("0::"), "IPV6 0:: should be valid");
    390389        // Invalid data
    391         assertFalse("IPV6 XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX should be invalid", validator.isValidInet6Address("XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX"));
     390        assertFalse(validator.isValidInet6Address("XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX"), "IPV6 XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX should be invalid");
    392391        // Too many components
    393         assertFalse("IPV6 1111:2222:3333:4444:5555:6666:7777:8888:9999 should be invalid", validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:7777:8888:9999"));
    394         assertFalse("IPV6 1111:2222:3333:4444:5555:6666:7777:8888:: should be invalid", validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:7777:8888::"));
    395         assertFalse("IPV6 ::2222:3333:4444:5555:6666:7777:8888:9999 should be invalid", validator.isValidInet6Address("::2222:3333:4444:5555:6666:7777:8888:9999"));
     392        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:7777:8888:9999"), "IPV6 1111:2222:3333:4444:5555:6666:7777:8888:9999 should be invalid");
     393        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:7777:8888::"), "IPV6 1111:2222:3333:4444:5555:6666:7777:8888:: should be invalid");
     394        assertFalse(validator.isValidInet6Address("::2222:3333:4444:5555:6666:7777:8888:9999"), "IPV6 ::2222:3333:4444:5555:6666:7777:8888:9999 should be invalid");
    396395        // Too few components
    397         assertFalse("IPV6 1111:2222:3333:4444:5555:6666:7777 should be invalid", validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:7777"));
    398         assertFalse("IPV6 1111:2222:3333:4444:5555:6666 should be invalid", validator.isValidInet6Address("1111:2222:3333:4444:5555:6666"));
    399         assertFalse("IPV6 1111:2222:3333:4444:5555 should be invalid", validator.isValidInet6Address("1111:2222:3333:4444:5555"));
    400         assertFalse("IPV6 1111:2222:3333:4444 should be invalid", validator.isValidInet6Address("1111:2222:3333:4444"));
    401         assertFalse("IPV6 1111:2222:3333 should be invalid", validator.isValidInet6Address("1111:2222:3333"));
    402         assertFalse("IPV6 1111:2222 should be invalid", validator.isValidInet6Address("1111:2222"));
    403         assertFalse("IPV6 1111 should be invalid", validator.isValidInet6Address("1111"));
     396        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:7777"), "IPV6 1111:2222:3333:4444:5555:6666:7777 should be invalid");
     397        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444:5555:6666"), "IPV6 1111:2222:3333:4444:5555:6666 should be invalid");
     398        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444:5555"), "IPV6 1111:2222:3333:4444:5555 should be invalid");
     399        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444"), "IPV6 1111:2222:3333:4444 should be invalid");
     400        assertFalse(validator.isValidInet6Address("1111:2222:3333"), "IPV6 1111:2222:3333 should be invalid");
     401        assertFalse(validator.isValidInet6Address("1111:2222"), "IPV6 1111:2222 should be invalid");
     402        assertFalse(validator.isValidInet6Address("1111"), "IPV6 1111 should be invalid");
    404403        // Missing :
    405         assertFalse("IPV6 11112222:3333:4444:5555:6666:7777:8888 should be invalid", validator.isValidInet6Address("11112222:3333:4444:5555:6666:7777:8888"));
    406         assertFalse("IPV6 1111:22223333:4444:5555:6666:7777:8888 should be invalid", validator.isValidInet6Address("1111:22223333:4444:5555:6666:7777:8888"));
    407         assertFalse("IPV6 1111:2222:33334444:5555:6666:7777:8888 should be invalid", validator.isValidInet6Address("1111:2222:33334444:5555:6666:7777:8888"));
    408         assertFalse("IPV6 1111:2222:3333:44445555:6666:7777:8888 should be invalid", validator.isValidInet6Address("1111:2222:3333:44445555:6666:7777:8888"));
    409         assertFalse("IPV6 1111:2222:3333:4444:55556666:7777:8888 should be invalid", validator.isValidInet6Address("1111:2222:3333:4444:55556666:7777:8888"));
    410         assertFalse("IPV6 1111:2222:3333:4444:5555:66667777:8888 should be invalid", validator.isValidInet6Address("1111:2222:3333:4444:5555:66667777:8888"));
    411         assertFalse("IPV6 1111:2222:3333:4444:5555:6666:77778888 should be invalid", validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:77778888"));
     404        assertFalse(validator.isValidInet6Address("11112222:3333:4444:5555:6666:7777:8888"), "IPV6 11112222:3333:4444:5555:6666:7777:8888 should be invalid");
     405        assertFalse(validator.isValidInet6Address("1111:22223333:4444:5555:6666:7777:8888"), "IPV6 1111:22223333:4444:5555:6666:7777:8888 should be invalid");
     406        assertFalse(validator.isValidInet6Address("1111:2222:33334444:5555:6666:7777:8888"), "IPV6 1111:2222:33334444:5555:6666:7777:8888 should be invalid");
     407        assertFalse(validator.isValidInet6Address("1111:2222:3333:44445555:6666:7777:8888"), "IPV6 1111:2222:3333:44445555:6666:7777:8888 should be invalid");
     408        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444:55556666:7777:8888"), "IPV6 1111:2222:3333:4444:55556666:7777:8888 should be invalid");
     409        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444:5555:66667777:8888"), "IPV6 1111:2222:3333:4444:5555:66667777:8888 should be invalid");
     410        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:77778888"), "IPV6 1111:2222:3333:4444:5555:6666:77778888 should be invalid");
    412411        // Missing : intended for ::
    413         assertFalse("IPV6 1111:2222:3333:4444:5555:6666:7777:8888: should be invalid", validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:7777:8888:"));
    414         assertFalse("IPV6 1111:2222:3333:4444:5555:6666:7777: should be invalid", validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:7777:"));
    415         assertFalse("IPV6 1111:2222:3333:4444:5555:6666: should be invalid", validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:"));
    416         assertFalse("IPV6 1111:2222:3333:4444:5555: should be invalid", validator.isValidInet6Address("1111:2222:3333:4444:5555:"));
    417         assertFalse("IPV6 1111:2222:3333:4444: should be invalid", validator.isValidInet6Address("1111:2222:3333:4444:"));
    418         assertFalse("IPV6 1111:2222:3333: should be invalid", validator.isValidInet6Address("1111:2222:3333:"));
    419         assertFalse("IPV6 1111:2222: should be invalid", validator.isValidInet6Address("1111:2222:"));
    420         assertFalse("IPV6 :8888 should be invalid", validator.isValidInet6Address(":8888"));
    421         assertFalse("IPV6 :7777:8888 should be invalid", validator.isValidInet6Address(":7777:8888"));
    422         assertFalse("IPV6 :6666:7777:8888 should be invalid", validator.isValidInet6Address(":6666:7777:8888"));
    423         assertFalse("IPV6 :5555:6666:7777:8888 should be invalid", validator.isValidInet6Address(":5555:6666:7777:8888"));
    424         assertFalse("IPV6 :4444:5555:6666:7777:8888 should be invalid", validator.isValidInet6Address(":4444:5555:6666:7777:8888"));
    425         assertFalse("IPV6 :3333:4444:5555:6666:7777:8888 should be invalid", validator.isValidInet6Address(":3333:4444:5555:6666:7777:8888"));
    426         assertFalse("IPV6 :2222:3333:4444:5555:6666:7777:8888 should be invalid", validator.isValidInet6Address(":2222:3333:4444:5555:6666:7777:8888"));
    427         assertFalse("IPV6 :1111:2222:3333:4444:5555:6666:7777:8888 should be invalid", validator.isValidInet6Address(":1111:2222:3333:4444:5555:6666:7777:8888"));
     412        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:7777:8888:"), "IPV6 1111:2222:3333:4444:5555:6666:7777:8888: should be invalid");
     413        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:7777:"), "IPV6 1111:2222:3333:4444:5555:6666:7777: should be invalid");
     414        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:"), "IPV6 1111:2222:3333:4444:5555:6666: should be invalid");
     415        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444:5555:"), "IPV6 1111:2222:3333:4444:5555: should be invalid");
     416        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444:"), "IPV6 1111:2222:3333:4444: should be invalid");
     417        assertFalse(validator.isValidInet6Address("1111:2222:3333:"), "IPV6 1111:2222:3333: should be invalid");
     418        assertFalse(validator.isValidInet6Address("1111:2222:"), "IPV6 1111:2222: should be invalid");
     419        assertFalse(validator.isValidInet6Address(":8888"), "IPV6 :8888 should be invalid");
     420        assertFalse(validator.isValidInet6Address(":7777:8888"), "IPV6 :7777:8888 should be invalid");
     421        assertFalse(validator.isValidInet6Address(":6666:7777:8888"), "IPV6 :6666:7777:8888 should be invalid");
     422        assertFalse(validator.isValidInet6Address(":5555:6666:7777:8888"), "IPV6 :5555:6666:7777:8888 should be invalid");
     423        assertFalse(validator.isValidInet6Address(":4444:5555:6666:7777:8888"), "IPV6 :4444:5555:6666:7777:8888 should be invalid");
     424        assertFalse(validator.isValidInet6Address(":3333:4444:5555:6666:7777:8888"), "IPV6 :3333:4444:5555:6666:7777:8888 should be invalid");
     425        assertFalse(validator.isValidInet6Address(":2222:3333:4444:5555:6666:7777:8888"), "IPV6 :2222:3333:4444:5555:6666:7777:8888 should be invalid");
     426        assertFalse(validator.isValidInet6Address(":1111:2222:3333:4444:5555:6666:7777:8888"), "IPV6 :1111:2222:3333:4444:5555:6666:7777:8888 should be invalid");
    428427        // :::
    429         assertFalse("IPV6 :::2222:3333:4444:5555:6666:7777:8888 should be invalid", validator.isValidInet6Address(":::2222:3333:4444:5555:6666:7777:8888"));
    430         assertFalse("IPV6 1111:::3333:4444:5555:6666:7777:8888 should be invalid", validator.isValidInet6Address("1111:::3333:4444:5555:6666:7777:8888"));
    431         assertFalse("IPV6 1111:2222:::4444:5555:6666:7777:8888 should be invalid", validator.isValidInet6Address("1111:2222:::4444:5555:6666:7777:8888"));
    432         assertFalse("IPV6 1111:2222:3333:::5555:6666:7777:8888 should be invalid", validator.isValidInet6Address("1111:2222:3333:::5555:6666:7777:8888"));
    433         assertFalse("IPV6 1111:2222:3333:4444:::6666:7777:8888 should be invalid", validator.isValidInet6Address("1111:2222:3333:4444:::6666:7777:8888"));
    434         assertFalse("IPV6 1111:2222:3333:4444:5555:::7777:8888 should be invalid", validator.isValidInet6Address("1111:2222:3333:4444:5555:::7777:8888"));
    435         assertFalse("IPV6 1111:2222:3333:4444:5555:6666:::8888 should be invalid", validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:::8888"));
    436         assertFalse("IPV6 1111:2222:3333:4444:5555:6666:7777::: should be invalid", validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:7777:::"));
     428        assertFalse(validator.isValidInet6Address(":::2222:3333:4444:5555:6666:7777:8888"), "IPV6 :::2222:3333:4444:5555:6666:7777:8888 should be invalid");
     429        assertFalse(validator.isValidInet6Address("1111:::3333:4444:5555:6666:7777:8888"), "IPV6 1111:::3333:4444:5555:6666:7777:8888 should be invalid");
     430        assertFalse(validator.isValidInet6Address("1111:2222:::4444:5555:6666:7777:8888"), "IPV6 1111:2222:::4444:5555:6666:7777:8888 should be invalid");
     431        assertFalse(validator.isValidInet6Address("1111:2222:3333:::5555:6666:7777:8888"), "IPV6 1111:2222:3333:::5555:6666:7777:8888 should be invalid");
     432        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444:::6666:7777:8888"), "IPV6 1111:2222:3333:4444:::6666:7777:8888 should be invalid");
     433        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444:5555:::7777:8888"), "IPV6 1111:2222:3333:4444:5555:::7777:8888 should be invalid");
     434        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:::8888"), "IPV6 1111:2222:3333:4444:5555:6666:::8888 should be invalid");
     435        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:7777:::"), "IPV6 1111:2222:3333:4444:5555:6666:7777::: should be invalid");
    437436        // Double ::
    438         assertFalse("IPV6 ::2222::4444:5555:6666:7777:8888 should be invalid", validator.isValidInet6Address("::2222::4444:5555:6666:7777:8888"));
    439         assertFalse("IPV6 ::2222:3333::5555:6666:7777:8888 should be invalid", validator.isValidInet6Address("::2222:3333::5555:6666:7777:8888"));
    440         assertFalse("IPV6 ::2222:3333:4444::6666:7777:8888 should be invalid", validator.isValidInet6Address("::2222:3333:4444::6666:7777:8888"));
    441         assertFalse("IPV6 ::2222:3333:4444:5555::7777:8888 should be invalid", validator.isValidInet6Address("::2222:3333:4444:5555::7777:8888"));
    442         assertFalse("IPV6 ::2222:3333:4444:5555:7777::8888 should be invalid", validator.isValidInet6Address("::2222:3333:4444:5555:7777::8888"));
    443         assertFalse("IPV6 ::2222:3333:4444:5555:7777:8888:: should be invalid", validator.isValidInet6Address("::2222:3333:4444:5555:7777:8888::"));
    444         assertFalse("IPV6 1111::3333::5555:6666:7777:8888 should be invalid", validator.isValidInet6Address("1111::3333::5555:6666:7777:8888"));
    445         assertFalse("IPV6 1111::3333:4444::6666:7777:8888 should be invalid", validator.isValidInet6Address("1111::3333:4444::6666:7777:8888"));
    446         assertFalse("IPV6 1111::3333:4444:5555::7777:8888 should be invalid", validator.isValidInet6Address("1111::3333:4444:5555::7777:8888"));
    447         assertFalse("IPV6 1111::3333:4444:5555:6666::8888 should be invalid", validator.isValidInet6Address("1111::3333:4444:5555:6666::8888"));
    448         assertFalse("IPV6 1111::3333:4444:5555:6666:7777:: should be invalid", validator.isValidInet6Address("1111::3333:4444:5555:6666:7777::"));
    449         assertFalse("IPV6 1111:2222::4444::6666:7777:8888 should be invalid", validator.isValidInet6Address("1111:2222::4444::6666:7777:8888"));
    450         assertFalse("IPV6 1111:2222::4444:5555::7777:8888 should be invalid", validator.isValidInet6Address("1111:2222::4444:5555::7777:8888"));
    451         assertFalse("IPV6 1111:2222::4444:5555:6666::8888 should be invalid", validator.isValidInet6Address("1111:2222::4444:5555:6666::8888"));
    452         assertFalse("IPV6 1111:2222::4444:5555:6666:7777:: should be invalid", validator.isValidInet6Address("1111:2222::4444:5555:6666:7777::"));
    453         assertFalse("IPV6 1111:2222:3333::5555::7777:8888 should be invalid", validator.isValidInet6Address("1111:2222:3333::5555::7777:8888"));
    454         assertFalse("IPV6 1111:2222:3333::5555:6666::8888 should be invalid", validator.isValidInet6Address("1111:2222:3333::5555:6666::8888"));
    455         assertFalse("IPV6 1111:2222:3333::5555:6666:7777:: should be invalid", validator.isValidInet6Address("1111:2222:3333::5555:6666:7777::"));
    456         assertFalse("IPV6 1111:2222:3333:4444::6666::8888 should be invalid", validator.isValidInet6Address("1111:2222:3333:4444::6666::8888"));
    457         assertFalse("IPV6 1111:2222:3333:4444::6666:7777:: should be invalid", validator.isValidInet6Address("1111:2222:3333:4444::6666:7777::"));
    458         assertFalse("IPV6 1111:2222:3333:4444:5555::7777:: should be invalid", validator.isValidInet6Address("1111:2222:3333:4444:5555::7777::"));
     437        assertFalse(validator.isValidInet6Address("::2222::4444:5555:6666:7777:8888"), "IPV6 ::2222::4444:5555:6666:7777:8888 should be invalid");
     438        assertFalse(validator.isValidInet6Address("::2222:3333::5555:6666:7777:8888"), "IPV6 ::2222:3333::5555:6666:7777:8888 should be invalid");
     439        assertFalse(validator.isValidInet6Address("::2222:3333:4444::6666:7777:8888"), "IPV6 ::2222:3333:4444::6666:7777:8888 should be invalid");
     440        assertFalse(validator.isValidInet6Address("::2222:3333:4444:5555::7777:8888"), "IPV6 ::2222:3333:4444:5555::7777:8888 should be invalid");
     441        assertFalse(validator.isValidInet6Address("::2222:3333:4444:5555:7777::8888"), "IPV6 ::2222:3333:4444:5555:7777::8888 should be invalid");
     442        assertFalse(validator.isValidInet6Address("::2222:3333:4444:5555:7777:8888::"), "IPV6 ::2222:3333:4444:5555:7777:8888:: should be invalid");
     443        assertFalse(validator.isValidInet6Address("1111::3333::5555:6666:7777:8888"), "IPV6 1111::3333::5555:6666:7777:8888 should be invalid");
     444        assertFalse(validator.isValidInet6Address("1111::3333:4444::6666:7777:8888"), "IPV6 1111::3333:4444::6666:7777:8888 should be invalid");
     445        assertFalse(validator.isValidInet6Address("1111::3333:4444:5555::7777:8888"), "IPV6 1111::3333:4444:5555::7777:8888 should be invalid");
     446        assertFalse(validator.isValidInet6Address("1111::3333:4444:5555:6666::8888"), "IPV6 1111::3333:4444:5555:6666::8888 should be invalid");
     447        assertFalse(validator.isValidInet6Address("1111::3333:4444:5555:6666:7777::"), "IPV6 1111::3333:4444:5555:6666:7777:: should be invalid");
     448        assertFalse(validator.isValidInet6Address("1111:2222::4444::6666:7777:8888"), "IPV6 1111:2222::4444::6666:7777:8888 should be invalid");
     449        assertFalse(validator.isValidInet6Address("1111:2222::4444:5555::7777:8888"), "IPV6 1111:2222::4444:5555::7777:8888 should be invalid");
     450        assertFalse(validator.isValidInet6Address("1111:2222::4444:5555:6666::8888"), "IPV6 1111:2222::4444:5555:6666::8888 should be invalid");
     451        assertFalse(validator.isValidInet6Address("1111:2222::4444:5555:6666:7777::"), "IPV6 1111:2222::4444:5555:6666:7777:: should be invalid");
     452        assertFalse(validator.isValidInet6Address("1111:2222:3333::5555::7777:8888"), "IPV6 1111:2222:3333::5555::7777:8888 should be invalid");
     453        assertFalse(validator.isValidInet6Address("1111:2222:3333::5555:6666::8888"), "IPV6 1111:2222:3333::5555:6666::8888 should be invalid");
     454        assertFalse(validator.isValidInet6Address("1111:2222:3333::5555:6666:7777::"), "IPV6 1111:2222:3333::5555:6666:7777:: should be invalid");
     455        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444::6666::8888"), "IPV6 1111:2222:3333:4444::6666::8888 should be invalid");
     456        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444::6666:7777::"), "IPV6 1111:2222:3333:4444::6666:7777:: should be invalid");
     457        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444:5555::7777::"), "IPV6 1111:2222:3333:4444:5555::7777:: should be invalid");
    459458        // Too many components"
    460         assertFalse("IPV6 1111:2222:3333:4444:5555:6666:7777:8888:1.2.3.4 should be invalid", validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:7777:8888:1.2.3.4"));
    461         assertFalse("IPV6 1111:2222:3333:4444:5555:6666:7777:1.2.3.4 should be invalid", validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:7777:1.2.3.4"));
    462         assertFalse("IPV6 1111:2222:3333:4444:5555:6666::1.2.3.4 should be invalid", validator.isValidInet6Address("1111:2222:3333:4444:5555:6666::1.2.3.4"));
    463         assertFalse("IPV6 ::2222:3333:4444:5555:6666:7777:1.2.3.4 should be invalid", validator.isValidInet6Address("::2222:3333:4444:5555:6666:7777:1.2.3.4"));
    464         assertFalse("IPV6 1111:2222:3333:4444:5555:6666:1.2.3.4.5 should be invalid", validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:1.2.3.4.5"));
     459        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:7777:8888:1.2.3.4"), "IPV6 1111:2222:3333:4444:5555:6666:7777:8888:1.2.3.4 should be invalid");
     460        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:7777:1.2.3.4"), "IPV6 1111:2222:3333:4444:5555:6666:7777:1.2.3.4 should be invalid");
     461        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444:5555:6666::1.2.3.4"), "IPV6 1111:2222:3333:4444:5555:6666::1.2.3.4 should be invalid");
     462        assertFalse(validator.isValidInet6Address("::2222:3333:4444:5555:6666:7777:1.2.3.4"), "IPV6 ::2222:3333:4444:5555:6666:7777:1.2.3.4 should be invalid");
     463        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:1.2.3.4.5"), "IPV6 1111:2222:3333:4444:5555:6666:1.2.3.4.5 should be invalid");
    465464        // Too few components
    466         assertFalse("IPV6 1111:2222:3333:4444:5555:1.2.3.4 should be invalid", validator.isValidInet6Address("1111:2222:3333:4444:5555:1.2.3.4"));
    467         assertFalse("IPV6 1111:2222:3333:4444:1.2.3.4 should be invalid", validator.isValidInet6Address("1111:2222:3333:4444:1.2.3.4"));
    468         assertFalse("IPV6 1111:2222:3333:1.2.3.4 should be invalid", validator.isValidInet6Address("1111:2222:3333:1.2.3.4"));
    469         assertFalse("IPV6 1111:2222:1.2.3.4 should be invalid", validator.isValidInet6Address("1111:2222:1.2.3.4"));
    470         assertFalse("IPV6 1111:1.2.3.4 should be invalid", validator.isValidInet6Address("1111:1.2.3.4"));
    471         assertFalse("IPV6 1.2.3.4 should be invalid", validator.isValidInet6Address("1.2.3.4"));
     465        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444:5555:1.2.3.4"), "IPV6 1111:2222:3333:4444:5555:1.2.3.4 should be invalid");
     466        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444:1.2.3.4"), "IPV6 1111:2222:3333:4444:1.2.3.4 should be invalid");
     467        assertFalse(validator.isValidInet6Address("1111:2222:3333:1.2.3.4"), "IPV6 1111:2222:3333:1.2.3.4 should be invalid");
     468        assertFalse(validator.isValidInet6Address("1111:2222:1.2.3.4"), "IPV6 1111:2222:1.2.3.4 should be invalid");
     469        assertFalse(validator.isValidInet6Address("1111:1.2.3.4"), "IPV6 1111:1.2.3.4 should be invalid");
     470        assertFalse(validator.isValidInet6Address("1.2.3.4"), "IPV6 1.2.3.4 should be invalid");
    472471        // Missing :
    473         assertFalse("IPV6 11112222:3333:4444:5555:6666:1.2.3.4 should be invalid", validator.isValidInet6Address("11112222:3333:4444:5555:6666:1.2.3.4"));
    474         assertFalse("IPV6 1111:22223333:4444:5555:6666:1.2.3.4 should be invalid", validator.isValidInet6Address("1111:22223333:4444:5555:6666:1.2.3.4"));
    475         assertFalse("IPV6 1111:2222:33334444:5555:6666:1.2.3.4 should be invalid", validator.isValidInet6Address("1111:2222:33334444:5555:6666:1.2.3.4"));
    476         assertFalse("IPV6 1111:2222:3333:44445555:6666:1.2.3.4 should be invalid", validator.isValidInet6Address("1111:2222:3333:44445555:6666:1.2.3.4"));
    477         assertFalse("IPV6 1111:2222:3333:4444:55556666:1.2.3.4 should be invalid", validator.isValidInet6Address("1111:2222:3333:4444:55556666:1.2.3.4"));
    478         assertFalse("IPV6 1111:2222:3333:4444:5555:66661.2.3.4 should be invalid", validator.isValidInet6Address("1111:2222:3333:4444:5555:66661.2.3.4"));
     472        assertFalse(validator.isValidInet6Address("11112222:3333:4444:5555:6666:1.2.3.4"), "IPV6 11112222:3333:4444:5555:6666:1.2.3.4 should be invalid");
     473        assertFalse(validator.isValidInet6Address("1111:22223333:4444:5555:6666:1.2.3.4"), "IPV6 1111:22223333:4444:5555:6666:1.2.3.4 should be invalid");
     474        assertFalse(validator.isValidInet6Address("1111:2222:33334444:5555:6666:1.2.3.4"), "IPV6 1111:2222:33334444:5555:6666:1.2.3.4 should be invalid");
     475        assertFalse(validator.isValidInet6Address("1111:2222:3333:44445555:6666:1.2.3.4"), "IPV6 1111:2222:3333:44445555:6666:1.2.3.4 should be invalid");
     476        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444:55556666:1.2.3.4"), "IPV6 1111:2222:3333:4444:55556666:1.2.3.4 should be invalid");
     477        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444:5555:66661.2.3.4"), "IPV6 1111:2222:3333:4444:5555:66661.2.3.4 should be invalid");
    479478        // Missing .
    480         assertFalse("IPV6 1111:2222:3333:4444:5555:6666:255255.255.255 should be invalid", validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:255255.255.255"));
    481         assertFalse("IPV6 1111:2222:3333:4444:5555:6666:255.255255.255 should be invalid", validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:255.255255.255"));
    482         assertFalse("IPV6 1111:2222:3333:4444:5555:6666:255.255.255255 should be invalid", validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:255.255.255255"));
     479        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:255255.255.255"), "IPV6 1111:2222:3333:4444:5555:6666:255255.255.255 should be invalid");
     480        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:255.255255.255"), "IPV6 1111:2222:3333:4444:5555:6666:255.255255.255 should be invalid");
     481        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:255.255.255255"), "IPV6 1111:2222:3333:4444:5555:6666:255.255.255255 should be invalid");
    483482        // Missing : intended for ::
    484         assertFalse("IPV6 :1.2.3.4 should be invalid", validator.isValidInet6Address(":1.2.3.4"));
    485         assertFalse("IPV6 :6666:1.2.3.4 should be invalid", validator.isValidInet6Address(":6666:1.2.3.4"));
    486         assertFalse("IPV6 :5555:6666:1.2.3.4 should be invalid", validator.isValidInet6Address(":5555:6666:1.2.3.4"));
    487         assertFalse("IPV6 :4444:5555:6666:1.2.3.4 should be invalid", validator.isValidInet6Address(":4444:5555:6666:1.2.3.4"));
    488         assertFalse("IPV6 :3333:4444:5555:6666:1.2.3.4 should be invalid", validator.isValidInet6Address(":3333:4444:5555:6666:1.2.3.4"));
    489         assertFalse("IPV6 :2222:3333:4444:5555:6666:1.2.3.4 should be invalid", validator.isValidInet6Address(":2222:3333:4444:5555:6666:1.2.3.4"));
    490         assertFalse("IPV6 :1111:2222:3333:4444:5555:6666:1.2.3.4 should be invalid", validator.isValidInet6Address(":1111:2222:3333:4444:5555:6666:1.2.3.4"));
     483        assertFalse(validator.isValidInet6Address(":1.2.3.4"), "IPV6 :1.2.3.4 should be invalid");
     484        assertFalse(validator.isValidInet6Address(":6666:1.2.3.4"), "IPV6 :6666:1.2.3.4 should be invalid");
     485        assertFalse(validator.isValidInet6Address(":5555:6666:1.2.3.4"), "IPV6 :5555:6666:1.2.3.4 should be invalid");
     486        assertFalse(validator.isValidInet6Address(":4444:5555:6666:1.2.3.4"), "IPV6 :4444:5555:6666:1.2.3.4 should be invalid");
     487        assertFalse(validator.isValidInet6Address(":3333:4444:5555:6666:1.2.3.4"), "IPV6 :3333:4444:5555:6666:1.2.3.4 should be invalid");
     488        assertFalse(validator.isValidInet6Address(":2222:3333:4444:5555:6666:1.2.3.4"), "IPV6 :2222:3333:4444:5555:6666:1.2.3.4 should be invalid");
     489        assertFalse(validator.isValidInet6Address(":1111:2222:3333:4444:5555:6666:1.2.3.4"), "IPV6 :1111:2222:3333:4444:5555:6666:1.2.3.4 should be invalid");
    491490        // :::
    492         assertFalse("IPV6 :::2222:3333:4444:5555:6666:1.2.3.4 should be invalid", validator.isValidInet6Address(":::2222:3333:4444:5555:6666:1.2.3.4"));
    493         assertFalse("IPV6 1111:::3333:4444:5555:6666:1.2.3.4 should be invalid", validator.isValidInet6Address("1111:::3333:4444:5555:6666:1.2.3.4"));
    494         assertFalse("IPV6 1111:2222:::4444:5555:6666:1.2.3.4 should be invalid", validator.isValidInet6Address("1111:2222:::4444:5555:6666:1.2.3.4"));
    495         assertFalse("IPV6 1111:2222:3333:::5555:6666:1.2.3.4 should be invalid", validator.isValidInet6Address("1111:2222:3333:::5555:6666:1.2.3.4"));
    496         assertFalse("IPV6 1111:2222:3333:4444:::6666:1.2.3.4 should be invalid", validator.isValidInet6Address("1111:2222:3333:4444:::6666:1.2.3.4"));
    497         assertFalse("IPV6 1111:2222:3333:4444:5555:::1.2.3.4 should be invalid", validator.isValidInet6Address("1111:2222:3333:4444:5555:::1.2.3.4"));
     491        assertFalse(validator.isValidInet6Address(":::2222:3333:4444:5555:6666:1.2.3.4"), "IPV6 :::2222:3333:4444:5555:6666:1.2.3.4 should be invalid");
     492        assertFalse(validator.isValidInet6Address("1111:::3333:4444:5555:6666:1.2.3.4"), "IPV6 1111:::3333:4444:5555:6666:1.2.3.4 should be invalid");
     493        assertFalse(validator.isValidInet6Address("1111:2222:::4444:5555:6666:1.2.3.4"), "IPV6 1111:2222:::4444:5555:6666:1.2.3.4 should be invalid");
     494        assertFalse(validator.isValidInet6Address("1111:2222:3333:::5555:6666:1.2.3.4"), "IPV6 1111:2222:3333:::5555:6666:1.2.3.4 should be invalid");
     495        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444:::6666:1.2.3.4"), "IPV6 1111:2222:3333:4444:::6666:1.2.3.4 should be invalid");
     496        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444:5555:::1.2.3.4"), "IPV6 1111:2222:3333:4444:5555:::1.2.3.4 should be invalid");
    498497        // Double ::
    499         assertFalse("IPV6 ::2222::4444:5555:6666:1.2.3.4 should be invalid", validator.isValidInet6Address("::2222::4444:5555:6666:1.2.3.4"));
    500         assertFalse("IPV6 ::2222:3333::5555:6666:1.2.3.4 should be invalid", validator.isValidInet6Address("::2222:3333::5555:6666:1.2.3.4"));
    501         assertFalse("IPV6 ::2222:3333:4444::6666:1.2.3.4 should be invalid", validator.isValidInet6Address("::2222:3333:4444::6666:1.2.3.4"));
    502         assertFalse("IPV6 ::2222:3333:4444:5555::1.2.3.4 should be invalid", validator.isValidInet6Address("::2222:3333:4444:5555::1.2.3.4"));
    503         assertFalse("IPV6 1111::3333::5555:6666:1.2.3.4 should be invalid", validator.isValidInet6Address("1111::3333::5555:6666:1.2.3.4"));
    504         assertFalse("IPV6 1111::3333:4444::6666:1.2.3.4 should be invalid", validator.isValidInet6Address("1111::3333:4444::6666:1.2.3.4"));
    505         assertFalse("IPV6 1111::3333:4444:5555::1.2.3.4 should be invalid", validator.isValidInet6Address("1111::3333:4444:5555::1.2.3.4"));
    506         assertFalse("IPV6 1111:2222::4444::6666:1.2.3.4 should be invalid", validator.isValidInet6Address("1111:2222::4444::6666:1.2.3.4"));
    507         assertFalse("IPV6 1111:2222::4444:5555::1.2.3.4 should be invalid", validator.isValidInet6Address("1111:2222::4444:5555::1.2.3.4"));
    508         assertFalse("IPV6 1111:2222:3333::5555::1.2.3.4 should be invalid", validator.isValidInet6Address("1111:2222:3333::5555::1.2.3.4"));
     498        assertFalse(validator.isValidInet6Address("::2222::4444:5555:6666:1.2.3.4"), "IPV6 ::2222::4444:5555:6666:1.2.3.4 should be invalid");
     499        assertFalse(validator.isValidInet6Address("::2222:3333::5555:6666:1.2.3.4"), "IPV6 ::2222:3333::5555:6666:1.2.3.4 should be invalid");
     500        assertFalse(validator.isValidInet6Address("::2222:3333:4444::6666:1.2.3.4"), "IPV6 ::2222:3333:4444::6666:1.2.3.4 should be invalid");
     501        assertFalse(validator.isValidInet6Address("::2222:3333:4444:5555::1.2.3.4"), "IPV6 ::2222:3333:4444:5555::1.2.3.4 should be invalid");
     502        assertFalse(validator.isValidInet6Address("1111::3333::5555:6666:1.2.3.4"), "IPV6 1111::3333::5555:6666:1.2.3.4 should be invalid");
     503        assertFalse(validator.isValidInet6Address("1111::3333:4444::6666:1.2.3.4"), "IPV6 1111::3333:4444::6666:1.2.3.4 should be invalid");
     504        assertFalse(validator.isValidInet6Address("1111::3333:4444:5555::1.2.3.4"), "IPV6 1111::3333:4444:5555::1.2.3.4 should be invalid");
     505        assertFalse(validator.isValidInet6Address("1111:2222::4444::6666:1.2.3.4"), "IPV6 1111:2222::4444::6666:1.2.3.4 should be invalid");
     506        assertFalse(validator.isValidInet6Address("1111:2222::4444:5555::1.2.3.4"), "IPV6 1111:2222::4444:5555::1.2.3.4 should be invalid");
     507        assertFalse(validator.isValidInet6Address("1111:2222:3333::5555::1.2.3.4"), "IPV6 1111:2222:3333::5555::1.2.3.4 should be invalid");
    509508        // Missing parts
    510         assertFalse("IPV6 ::. should be invalid", validator.isValidInet6Address("::."));
    511         assertFalse("IPV6 ::.. should be invalid", validator.isValidInet6Address("::.."));
    512         assertFalse("IPV6 ::... should be invalid", validator.isValidInet6Address("::..."));
    513         assertFalse("IPV6 ::1... should be invalid", validator.isValidInet6Address("::1..."));
    514         assertFalse("IPV6 ::1.2.. should be invalid", validator.isValidInet6Address("::1.2.."));
    515         assertFalse("IPV6 ::1.2.3. should be invalid", validator.isValidInet6Address("::1.2.3."));
    516         assertFalse("IPV6 ::.2.. should be invalid", validator.isValidInet6Address("::.2.."));
    517         assertFalse("IPV6 ::.2.3. should be invalid", validator.isValidInet6Address("::.2.3."));
    518         assertFalse("IPV6 ::.2.3.4 should be invalid", validator.isValidInet6Address("::.2.3.4"));
    519         assertFalse("IPV6 ::..3. should be invalid", validator.isValidInet6Address("::..3."));
    520         assertFalse("IPV6 ::..3.4 should be invalid", validator.isValidInet6Address("::..3.4"));
    521         assertFalse("IPV6 ::...4 should be invalid", validator.isValidInet6Address("::...4"));
     509        assertFalse(validator.isValidInet6Address("::."), "IPV6 ::. should be invalid");
     510        assertFalse(validator.isValidInet6Address("::.."), "IPV6 ::.. should be invalid");
     511        assertFalse(validator.isValidInet6Address("::..."), "IPV6 ::... should be invalid");
     512        assertFalse(validator.isValidInet6Address("::1..."), "IPV6 ::1... should be invalid");
     513        assertFalse(validator.isValidInet6Address("::1.2.."), "IPV6 ::1.2.. should be invalid");
     514        assertFalse(validator.isValidInet6Address("::1.2.3."), "IPV6 ::1.2.3. should be invalid");
     515        assertFalse(validator.isValidInet6Address("::.2.."), "IPV6 ::.2.. should be invalid");
     516        assertFalse(validator.isValidInet6Address("::.2.3."), "IPV6 ::.2.3. should be invalid");
     517        assertFalse(validator.isValidInet6Address("::.2.3.4"), "IPV6 ::.2.3.4 should be invalid");
     518        assertFalse(validator.isValidInet6Address("::..3."), "IPV6 ::..3. should be invalid");
     519        assertFalse(validator.isValidInet6Address("::..3.4"), "IPV6 ::..3.4 should be invalid");
     520        assertFalse(validator.isValidInet6Address("::...4"), "IPV6 ::...4 should be invalid");
    522521        // Extra : in front
    523         assertFalse("IPV6 :1111:2222:3333:4444:5555:6666:7777:: should be invalid", validator.isValidInet6Address(":1111:2222:3333:4444:5555:6666:7777::"));
    524         assertFalse("IPV6 :1111:2222:3333:4444:5555:6666:: should be invalid", validator.isValidInet6Address(":1111:2222:3333:4444:5555:6666::"));
    525         assertFalse("IPV6 :1111:2222:3333:4444:5555:: should be invalid", validator.isValidInet6Address(":1111:2222:3333:4444:5555::"));
    526         assertFalse("IPV6 :1111:2222:3333:4444:: should be invalid", validator.isValidInet6Address(":1111:2222:3333:4444::"));
    527         assertFalse("IPV6 :1111:2222:3333:: should be invalid", validator.isValidInet6Address(":1111:2222:3333::"));
    528         assertFalse("IPV6 :1111:2222:: should be invalid", validator.isValidInet6Address(":1111:2222::"));
    529         assertFalse("IPV6 :1111:: should be invalid", validator.isValidInet6Address(":1111::"));
    530         assertFalse("IPV6 :1111:2222:3333:4444:5555:6666::8888 should be invalid", validator.isValidInet6Address(":1111:2222:3333:4444:5555:6666::8888"));
    531         assertFalse("IPV6 :1111:2222:3333:4444:5555::8888 should be invalid", validator.isValidInet6Address(":1111:2222:3333:4444:5555::8888"));
    532         assertFalse("IPV6 :1111:2222:3333:4444::8888 should be invalid", validator.isValidInet6Address(":1111:2222:3333:4444::8888"));
    533         assertFalse("IPV6 :1111:2222:3333::8888 should be invalid", validator.isValidInet6Address(":1111:2222:3333::8888"));
    534         assertFalse("IPV6 :1111:2222::8888 should be invalid", validator.isValidInet6Address(":1111:2222::8888"));
    535         assertFalse("IPV6 :1111::8888 should be invalid", validator.isValidInet6Address(":1111::8888"));
    536         assertFalse("IPV6 :::8888 should be invalid", validator.isValidInet6Address(":::8888"));
    537         assertFalse("IPV6 :1111:2222:3333:4444:5555::7777:8888 should be invalid", validator.isValidInet6Address(":1111:2222:3333:4444:5555::7777:8888"));
    538         assertFalse("IPV6 :1111:2222:3333:4444::7777:8888 should be invalid", validator.isValidInet6Address(":1111:2222:3333:4444::7777:8888"));
    539         assertFalse("IPV6 :1111:2222:3333::7777:8888 should be invalid", validator.isValidInet6Address(":1111:2222:3333::7777:8888"));
    540         assertFalse("IPV6 :1111:2222::7777:8888 should be invalid", validator.isValidInet6Address(":1111:2222::7777:8888"));
    541         assertFalse("IPV6 :1111::7777:8888 should be invalid", validator.isValidInet6Address(":1111::7777:8888"));
    542         assertFalse("IPV6 :::7777:8888 should be invalid", validator.isValidInet6Address(":::7777:8888"));
    543         assertFalse("IPV6 :1111:2222:3333:4444::6666:7777:8888 should be invalid", validator.isValidInet6Address(":1111:2222:3333:4444::6666:7777:8888"));
    544         assertFalse("IPV6 :1111:2222:3333::6666:7777:8888 should be invalid", validator.isValidInet6Address(":1111:2222:3333::6666:7777:8888"));
    545         assertFalse("IPV6 :1111:2222::6666:7777:8888 should be invalid", validator.isValidInet6Address(":1111:2222::6666:7777:8888"));
    546         assertFalse("IPV6 :1111::6666:7777:8888 should be invalid", validator.isValidInet6Address(":1111::6666:7777:8888"));
    547         assertFalse("IPV6 :::6666:7777:8888 should be invalid", validator.isValidInet6Address(":::6666:7777:8888"));
    548         assertFalse("IPV6 :1111:2222:3333::5555:6666:7777:8888 should be invalid", validator.isValidInet6Address(":1111:2222:3333::5555:6666:7777:8888"));
    549         assertFalse("IPV6 :1111:2222::5555:6666:7777:8888 should be invalid", validator.isValidInet6Address(":1111:2222::5555:6666:7777:8888"));
    550         assertFalse("IPV6 :1111::5555:6666:7777:8888 should be invalid", validator.isValidInet6Address(":1111::5555:6666:7777:8888"));
    551         assertFalse("IPV6 :::5555:6666:7777:8888 should be invalid", validator.isValidInet6Address(":::5555:6666:7777:8888"));
    552         assertFalse("IPV6 :1111:2222::4444:5555:6666:7777:8888 should be invalid", validator.isValidInet6Address(":1111:2222::4444:5555:6666:7777:8888"));
    553         assertFalse("IPV6 :1111::4444:5555:6666:7777:8888 should be invalid", validator.isValidInet6Address(":1111::4444:5555:6666:7777:8888"));
    554         assertFalse("IPV6 :::4444:5555:6666:7777:8888 should be invalid", validator.isValidInet6Address(":::4444:5555:6666:7777:8888"));
    555         assertFalse("IPV6 :1111::3333:4444:5555:6666:7777:8888 should be invalid", validator.isValidInet6Address(":1111::3333:4444:5555:6666:7777:8888"));
    556         assertFalse("IPV6 :::3333:4444:5555:6666:7777:8888 should be invalid", validator.isValidInet6Address(":::3333:4444:5555:6666:7777:8888"));
    557         assertFalse("IPV6 :::2222:3333:4444:5555:6666:7777:8888 should be invalid", validator.isValidInet6Address(":::2222:3333:4444:5555:6666:7777:8888"));
    558         assertFalse("IPV6 :1111:2222:3333:4444:5555:6666:1.2.3.4 should be invalid", validator.isValidInet6Address(":1111:2222:3333:4444:5555:6666:1.2.3.4"));
    559         assertFalse("IPV6 :1111:2222:3333:4444:5555::1.2.3.4 should be invalid", validator.isValidInet6Address(":1111:2222:3333:4444:5555::1.2.3.4"));
    560         assertFalse("IPV6 :1111:2222:3333:4444::1.2.3.4 should be invalid", validator.isValidInet6Address(":1111:2222:3333:4444::1.2.3.4"));
    561         assertFalse("IPV6 :1111:2222:3333::1.2.3.4 should be invalid", validator.isValidInet6Address(":1111:2222:3333::1.2.3.4"));
    562         assertFalse("IPV6 :1111:2222::1.2.3.4 should be invalid", validator.isValidInet6Address(":1111:2222::1.2.3.4"));
    563         assertFalse("IPV6 :1111::1.2.3.4 should be invalid", validator.isValidInet6Address(":1111::1.2.3.4"));
    564         assertFalse("IPV6 :::1.2.3.4 should be invalid", validator.isValidInet6Address(":::1.2.3.4"));
    565         assertFalse("IPV6 :1111:2222:3333:4444::6666:1.2.3.4 should be invalid", validator.isValidInet6Address(":1111:2222:3333:4444::6666:1.2.3.4"));
    566         assertFalse("IPV6 :1111:2222:3333::6666:1.2.3.4 should be invalid", validator.isValidInet6Address(":1111:2222:3333::6666:1.2.3.4"));
    567         assertFalse("IPV6 :1111:2222::6666:1.2.3.4 should be invalid", validator.isValidInet6Address(":1111:2222::6666:1.2.3.4"));
    568         assertFalse("IPV6 :1111::6666:1.2.3.4 should be invalid", validator.isValidInet6Address(":1111::6666:1.2.3.4"));
    569         assertFalse("IPV6 :::6666:1.2.3.4 should be invalid", validator.isValidInet6Address(":::6666:1.2.3.4"));
    570         assertFalse("IPV6 :1111:2222:3333::5555:6666:1.2.3.4 should be invalid", validator.isValidInet6Address(":1111:2222:3333::5555:6666:1.2.3.4"));
    571         assertFalse("IPV6 :1111:2222::5555:6666:1.2.3.4 should be invalid", validator.isValidInet6Address(":1111:2222::5555:6666:1.2.3.4"));
    572         assertFalse("IPV6 :1111::5555:6666:1.2.3.4 should be invalid", validator.isValidInet6Address(":1111::5555:6666:1.2.3.4"));
    573         assertFalse("IPV6 :::5555:6666:1.2.3.4 should be invalid", validator.isValidInet6Address(":::5555:6666:1.2.3.4"));
    574         assertFalse("IPV6 :1111:2222::4444:5555:6666:1.2.3.4 should be invalid", validator.isValidInet6Address(":1111:2222::4444:5555:6666:1.2.3.4"));
    575         assertFalse("IPV6 :1111::4444:5555:6666:1.2.3.4 should be invalid", validator.isValidInet6Address(":1111::4444:5555:6666:1.2.3.4"));
    576         assertFalse("IPV6 :::4444:5555:6666:1.2.3.4 should be invalid", validator.isValidInet6Address(":::4444:5555:6666:1.2.3.4"));
    577         assertFalse("IPV6 :1111::3333:4444:5555:6666:1.2.3.4 should be invalid", validator.isValidInet6Address(":1111::3333:4444:5555:6666:1.2.3.4"));
    578         assertFalse("IPV6 :::2222:3333:4444:5555:6666:1.2.3.4 should be invalid", validator.isValidInet6Address(":::2222:3333:4444:5555:6666:1.2.3.4"));
     522        assertFalse(validator.isValidInet6Address(":1111:2222:3333:4444:5555:6666:7777::"), "IPV6 :1111:2222:3333:4444:5555:6666:7777:: should be invalid");
     523        assertFalse(validator.isValidInet6Address(":1111:2222:3333:4444:5555:6666::"), "IPV6 :1111:2222:3333:4444:5555:6666:: should be invalid");
     524        assertFalse(validator.isValidInet6Address(":1111:2222:3333:4444:5555::"), "IPV6 :1111:2222:3333:4444:5555:: should be invalid");
     525        assertFalse(validator.isValidInet6Address(":1111:2222:3333:4444::"), "IPV6 :1111:2222:3333:4444:: should be invalid");
     526        assertFalse(validator.isValidInet6Address(":1111:2222:3333::"), "IPV6 :1111:2222:3333:: should be invalid");
     527        assertFalse(validator.isValidInet6Address(":1111:2222::"), "IPV6 :1111:2222:: should be invalid");
     528        assertFalse(validator.isValidInet6Address(":1111::"), "IPV6 :1111:: should be invalid");
     529        assertFalse(validator.isValidInet6Address(":1111:2222:3333:4444:5555:6666::8888"), "IPV6 :1111:2222:3333:4444:5555:6666::8888 should be invalid");
     530        assertFalse(validator.isValidInet6Address(":1111:2222:3333:4444:5555::8888"), "IPV6 :1111:2222:3333:4444:5555::8888 should be invalid");
     531        assertFalse(validator.isValidInet6Address(":1111:2222:3333:4444::8888"), "IPV6 :1111:2222:3333:4444::8888 should be invalid");
     532        assertFalse(validator.isValidInet6Address(":1111:2222:3333::8888"), "IPV6 :1111:2222:3333::8888 should be invalid");
     533        assertFalse(validator.isValidInet6Address(":1111:2222::8888"), "IPV6 :1111:2222::8888 should be invalid");
     534        assertFalse(validator.isValidInet6Address(":1111::8888"), "IPV6 :1111::8888 should be invalid");
     535        assertFalse(validator.isValidInet6Address(":::8888"), "IPV6 :::8888 should be invalid");
     536        assertFalse(validator.isValidInet6Address(":1111:2222:3333:4444:5555::7777:8888"), "IPV6 :1111:2222:3333:4444:5555::7777:8888 should be invalid");
     537        assertFalse(validator.isValidInet6Address(":1111:2222:3333:4444::7777:8888"), "IPV6 :1111:2222:3333:4444::7777:8888 should be invalid");
     538        assertFalse(validator.isValidInet6Address(":1111:2222:3333::7777:8888"), "IPV6 :1111:2222:3333::7777:8888 should be invalid");
     539        assertFalse(validator.isValidInet6Address(":1111:2222::7777:8888"), "IPV6 :1111:2222::7777:8888 should be invalid");
     540        assertFalse(validator.isValidInet6Address(":1111::7777:8888"), "IPV6 :1111::7777:8888 should be invalid");
     541        assertFalse(validator.isValidInet6Address(":::7777:8888"), "IPV6 :::7777:8888 should be invalid");
     542        assertFalse(validator.isValidInet6Address(":1111:2222:3333:4444::6666:7777:8888"), "IPV6 :1111:2222:3333:4444::6666:7777:8888 should be invalid");
     543        assertFalse(validator.isValidInet6Address(":1111:2222:3333::6666:7777:8888"), "IPV6 :1111:2222:3333::6666:7777:8888 should be invalid");
     544        assertFalse(validator.isValidInet6Address(":1111:2222::6666:7777:8888"), "IPV6 :1111:2222::6666:7777:8888 should be invalid");
     545        assertFalse(validator.isValidInet6Address(":1111::6666:7777:8888"), "IPV6 :1111::6666:7777:8888 should be invalid");
     546        assertFalse(validator.isValidInet6Address(":::6666:7777:8888"), "IPV6 :::6666:7777:8888 should be invalid");
     547        assertFalse(validator.isValidInet6Address(":1111:2222:3333::5555:6666:7777:8888"), "IPV6 :1111:2222:3333::5555:6666:7777:8888 should be invalid");
     548        assertFalse(validator.isValidInet6Address(":1111:2222::5555:6666:7777:8888"), "IPV6 :1111:2222::5555:6666:7777:8888 should be invalid");
     549        assertFalse(validator.isValidInet6Address(":1111::5555:6666:7777:8888"), "IPV6 :1111::5555:6666:7777:8888 should be invalid");
     550        assertFalse(validator.isValidInet6Address(":::5555:6666:7777:8888"), "IPV6 :::5555:6666:7777:8888 should be invalid");
     551        assertFalse(validator.isValidInet6Address(":1111:2222::4444:5555:6666:7777:8888"), "IPV6 :1111:2222::4444:5555:6666:7777:8888 should be invalid");
     552        assertFalse(validator.isValidInet6Address(":1111::4444:5555:6666:7777:8888"), "IPV6 :1111::4444:5555:6666:7777:8888 should be invalid");
     553        assertFalse(validator.isValidInet6Address(":::4444:5555:6666:7777:8888"), "IPV6 :::4444:5555:6666:7777:8888 should be invalid");
     554        assertFalse(validator.isValidInet6Address(":1111::3333:4444:5555:6666:7777:8888"), "IPV6 :1111::3333:4444:5555:6666:7777:8888 should be invalid");
     555        assertFalse(validator.isValidInet6Address(":::3333:4444:5555:6666:7777:8888"), "IPV6 :::3333:4444:5555:6666:7777:8888 should be invalid");
     556        assertFalse(validator.isValidInet6Address(":::2222:3333:4444:5555:6666:7777:8888"), "IPV6 :::2222:3333:4444:5555:6666:7777:8888 should be invalid");
     557        assertFalse(validator.isValidInet6Address(":1111:2222:3333:4444:5555:6666:1.2.3.4"), "IPV6 :1111:2222:3333:4444:5555:6666:1.2.3.4 should be invalid");
     558        assertFalse(validator.isValidInet6Address(":1111:2222:3333:4444:5555::1.2.3.4"), "IPV6 :1111:2222:3333:4444:5555::1.2.3.4 should be invalid");
     559        assertFalse(validator.isValidInet6Address(":1111:2222:3333:4444::1.2.3.4"), "IPV6 :1111:2222:3333:4444::1.2.3.4 should be invalid");
     560        assertFalse(validator.isValidInet6Address(":1111:2222:3333::1.2.3.4"), "IPV6 :1111:2222:3333::1.2.3.4 should be invalid");
     561        assertFalse(validator.isValidInet6Address(":1111:2222::1.2.3.4"), "IPV6 :1111:2222::1.2.3.4 should be invalid");
     562        assertFalse(validator.isValidInet6Address(":1111::1.2.3.4"), "IPV6 :1111::1.2.3.4 should be invalid");
     563        assertFalse(validator.isValidInet6Address(":::1.2.3.4"), "IPV6 :::1.2.3.4 should be invalid");
     564        assertFalse(validator.isValidInet6Address(":1111:2222:3333:4444::6666:1.2.3.4"), "IPV6 :1111:2222:3333:4444::6666:1.2.3.4 should be invalid");
     565        assertFalse(validator.isValidInet6Address(":1111:2222:3333::6666:1.2.3.4"), "IPV6 :1111:2222:3333::6666:1.2.3.4 should be invalid");
     566        assertFalse(validator.isValidInet6Address(":1111:2222::6666:1.2.3.4"), "IPV6 :1111:2222::6666:1.2.3.4 should be invalid");
     567        assertFalse(validator.isValidInet6Address(":1111::6666:1.2.3.4"), "IPV6 :1111::6666:1.2.3.4 should be invalid");
     568        assertFalse(validator.isValidInet6Address(":::6666:1.2.3.4"), "IPV6 :::6666:1.2.3.4 should be invalid");
     569        assertFalse(validator.isValidInet6Address(":1111:2222:3333::5555:6666:1.2.3.4"), "IPV6 :1111:2222:3333::5555:6666:1.2.3.4 should be invalid");
     570        assertFalse(validator.isValidInet6Address(":1111:2222::5555:6666:1.2.3.4"), "IPV6 :1111:2222::5555:6666:1.2.3.4 should be invalid");
     571        assertFalse(validator.isValidInet6Address(":1111::5555:6666:1.2.3.4"), "IPV6 :1111::5555:6666:1.2.3.4 should be invalid");
     572        assertFalse(validator.isValidInet6Address(":::5555:6666:1.2.3.4"), "IPV6 :::5555:6666:1.2.3.4 should be invalid");
     573        assertFalse(validator.isValidInet6Address(":1111:2222::4444:5555:6666:1.2.3.4"), "IPV6 :1111:2222::4444:5555:6666:1.2.3.4 should be invalid");
     574        assertFalse(validator.isValidInet6Address(":1111::4444:5555:6666:1.2.3.4"), "IPV6 :1111::4444:5555:6666:1.2.3.4 should be invalid");
     575        assertFalse(validator.isValidInet6Address(":::4444:5555:6666:1.2.3.4"), "IPV6 :::4444:5555:6666:1.2.3.4 should be invalid");
     576        assertFalse(validator.isValidInet6Address(":1111::3333:4444:5555:6666:1.2.3.4"), "IPV6 :1111::3333:4444:5555:6666:1.2.3.4 should be invalid");
     577        assertFalse(validator.isValidInet6Address(":::2222:3333:4444:5555:6666:1.2.3.4"), "IPV6 :::2222:3333:4444:5555:6666:1.2.3.4 should be invalid");
    579578        // Extra : at end
    580         assertFalse("IPV6 1111:2222:3333:4444:5555:6666:7777::: should be invalid", validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:7777:::"));
    581         assertFalse("IPV6 1111:2222:3333:4444:5555:6666::: should be invalid", validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:::"));
    582         assertFalse("IPV6 1111:2222:3333:4444:5555::: should be invalid", validator.isValidInet6Address("1111:2222:3333:4444:5555:::"));
    583         assertFalse("IPV6 1111:2222:3333:4444::: should be invalid", validator.isValidInet6Address("1111:2222:3333:4444:::"));
    584         assertFalse("IPV6 1111:2222:3333::: should be invalid", validator.isValidInet6Address("1111:2222:3333:::"));
    585         assertFalse("IPV6 1111:2222::: should be invalid", validator.isValidInet6Address("1111:2222:::"));
    586         assertFalse("IPV6 1111::: should be invalid", validator.isValidInet6Address("1111:::"));
    587         assertFalse("IPV6 1111:2222:3333:4444:5555:6666::8888: should be invalid", validator.isValidInet6Address("1111:2222:3333:4444:5555:6666::8888:"));
    588         assertFalse("IPV6 1111:2222:3333:4444:5555::8888: should be invalid", validator.isValidInet6Address("1111:2222:3333:4444:5555::8888:"));
    589         assertFalse("IPV6 1111:2222:3333:4444::8888: should be invalid", validator.isValidInet6Address("1111:2222:3333:4444::8888:"));
    590         assertFalse("IPV6 1111:2222:3333::8888: should be invalid", validator.isValidInet6Address("1111:2222:3333::8888:"));
    591         assertFalse("IPV6 1111:2222::8888: should be invalid", validator.isValidInet6Address("1111:2222::8888:"));
    592         assertFalse("IPV6 1111::8888: should be invalid", validator.isValidInet6Address("1111::8888:"));
    593         assertFalse("IPV6 ::8888: should be invalid", validator.isValidInet6Address("::8888:"));
    594         assertFalse("IPV6 1111:2222:3333:4444:5555::7777:8888: should be invalid", validator.isValidInet6Address("1111:2222:3333:4444:5555::7777:8888:"));
    595         assertFalse("IPV6 1111:2222:3333:4444::7777:8888: should be invalid", validator.isValidInet6Address("1111:2222:3333:4444::7777:8888:"));
    596         assertFalse("IPV6 1111:2222:3333::7777:8888: should be invalid", validator.isValidInet6Address("1111:2222:3333::7777:8888:"));
    597         assertFalse("IPV6 1111:2222::7777:8888: should be invalid", validator.isValidInet6Address("1111:2222::7777:8888:"));
    598         assertFalse("IPV6 1111::7777:8888: should be invalid", validator.isValidInet6Address("1111::7777:8888:"));
    599         assertFalse("IPV6 ::7777:8888: should be invalid", validator.isValidInet6Address("::7777:8888:"));
    600         assertFalse("IPV6 1111:2222:3333:4444::6666:7777:8888: should be invalid", validator.isValidInet6Address("1111:2222:3333:4444::6666:7777:8888:"));
    601         assertFalse("IPV6 1111:2222:3333::6666:7777:8888: should be invalid", validator.isValidInet6Address("1111:2222:3333::6666:7777:8888:"));
    602         assertFalse("IPV6 1111:2222::6666:7777:8888: should be invalid", validator.isValidInet6Address("1111:2222::6666:7777:8888:"));
    603         assertFalse("IPV6 1111::6666:7777:8888: should be invalid", validator.isValidInet6Address("1111::6666:7777:8888:"));
    604         assertFalse("IPV6 ::6666:7777:8888: should be invalid", validator.isValidInet6Address("::6666:7777:8888:"));
    605         assertFalse("IPV6 1111:2222:3333::5555:6666:7777:8888: should be invalid", validator.isValidInet6Address("1111:2222:3333::5555:6666:7777:8888:"));
    606         assertFalse("IPV6 1111:2222::5555:6666:7777:8888: should be invalid", validator.isValidInet6Address("1111:2222::5555:6666:7777:8888:"));
    607         assertFalse("IPV6 1111::5555:6666:7777:8888: should be invalid", validator.isValidInet6Address("1111::5555:6666:7777:8888:"));
    608         assertFalse("IPV6 ::5555:6666:7777:8888: should be invalid", validator.isValidInet6Address("::5555:6666:7777:8888:"));
    609         assertFalse("IPV6 1111:2222::4444:5555:6666:7777:8888: should be invalid", validator.isValidInet6Address("1111:2222::4444:5555:6666:7777:8888:"));
    610         assertFalse("IPV6 1111::4444:5555:6666:7777:8888: should be invalid", validator.isValidInet6Address("1111::4444:5555:6666:7777:8888:"));
    611         assertFalse("IPV6 ::4444:5555:6666:7777:8888: should be invalid", validator.isValidInet6Address("::4444:5555:6666:7777:8888:"));
    612         assertFalse("IPV6 1111::3333:4444:5555:6666:7777:8888: should be invalid", validator.isValidInet6Address("1111::3333:4444:5555:6666:7777:8888:"));
    613         assertFalse("IPV6 ::3333:4444:5555:6666:7777:8888: should be invalid", validator.isValidInet6Address("::3333:4444:5555:6666:7777:8888:"));
    614         assertFalse("IPV6 ::2222:3333:4444:5555:6666:7777:8888: should be invalid", validator.isValidInet6Address("::2222:3333:4444:5555:6666:7777:8888:"));
    615         assertTrue("IPV6 0:a:b:c:d:e:f:: should be valid", validator.isValidInet6Address("0:a:b:c:d:e:f::"));
    616         assertTrue("IPV6 ::0:a:b:c:d:e:f should be valid", validator.isValidInet6Address("::0:a:b:c:d:e:f")); // syntactically correct, but bad form (::0:... could be combined)
    617         assertTrue("IPV6 a:b:c:d:e:f:0:: should be valid", validator.isValidInet6Address("a:b:c:d:e:f:0::"));
    618         assertFalse("IPV6 ':10.0.0.1 should be invalid", validator.isValidInet6Address("':10.0.0.1"));
     579        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:7777:::"), "IPV6 1111:2222:3333:4444:5555:6666:7777::: should be invalid");
     580        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444:5555:6666:::"), "IPV6 1111:2222:3333:4444:5555:6666::: should be invalid");
     581        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444:5555:::"), "IPV6 1111:2222:3333:4444:5555::: should be invalid");
     582        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444:::"), "IPV6 1111:2222:3333:4444::: should be invalid");
     583        assertFalse(validator.isValidInet6Address("1111:2222:3333:::"), "IPV6 1111:2222:3333::: should be invalid");
     584        assertFalse(validator.isValidInet6Address("1111:2222:::"), "IPV6 1111:2222::: should be invalid");
     585        assertFalse(validator.isValidInet6Address("1111:::"), "IPV6 1111::: should be invalid");
     586        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444:5555:6666::8888:"), "IPV6 1111:2222:3333:4444:5555:6666::8888: should be invalid");
     587        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444:5555::8888:"), "IPV6 1111:2222:3333:4444:5555::8888: should be invalid");
     588        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444::8888:"), "IPV6 1111:2222:3333:4444::8888: should be invalid");
     589        assertFalse(validator.isValidInet6Address("1111:2222:3333::8888:"), "IPV6 1111:2222:3333::8888: should be invalid");
     590        assertFalse(validator.isValidInet6Address("1111:2222::8888:"), "IPV6 1111:2222::8888: should be invalid");
     591        assertFalse(validator.isValidInet6Address("1111::8888:"), "IPV6 1111::8888: should be invalid");
     592        assertFalse(validator.isValidInet6Address("::8888:"), "IPV6 ::8888: should be invalid");
     593        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444:5555::7777:8888:"), "IPV6 1111:2222:3333:4444:5555::7777:8888: should be invalid");
     594        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444::7777:8888:"), "IPV6 1111:2222:3333:4444::7777:8888: should be invalid");
     595        assertFalse(validator.isValidInet6Address("1111:2222:3333::7777:8888:"), "IPV6 1111:2222:3333::7777:8888: should be invalid");
     596        assertFalse(validator.isValidInet6Address("1111:2222::7777:8888:"), "IPV6 1111:2222::7777:8888: should be invalid");
     597        assertFalse(validator.isValidInet6Address("1111::7777:8888:"), "IPV6 1111::7777:8888: should be invalid");
     598        assertFalse(validator.isValidInet6Address("::7777:8888:"), "IPV6 ::7777:8888: should be invalid");
     599        assertFalse(validator.isValidInet6Address("1111:2222:3333:4444::6666:7777:8888:"), "IPV6 1111:2222:3333:4444::6666:7777:8888: should be invalid");
     600        assertFalse(validator.isValidInet6Address("1111:2222:3333::6666:7777:8888:"), "IPV6 1111:2222:3333::6666:7777:8888: should be invalid");
     601        assertFalse(validator.isValidInet6Address("1111:2222::6666:7777:8888:"), "IPV6 1111:2222::6666:7777:8888: should be invalid");
     602        assertFalse(validator.isValidInet6Address("1111::6666:7777:8888:"), "IPV6 1111::6666:7777:8888: should be invalid");
     603        assertFalse(validator.isValidInet6Address("::6666:7777:8888:"), "IPV6 ::6666:7777:8888: should be invalid");
     604        assertFalse(validator.isValidInet6Address("1111:2222:3333::5555:6666:7777:8888:"), "IPV6 1111:2222:3333::5555:6666:7777:8888: should be invalid");
     605        assertFalse(validator.isValidInet6Address("1111:2222::5555:6666:7777:8888:"), "IPV6 1111:2222::5555:6666:7777:8888: should be invalid");
     606        assertFalse(validator.isValidInet6Address("1111::5555:6666:7777:8888:"), "IPV6 1111::5555:6666:7777:8888: should be invalid");
     607        assertFalse(validator.isValidInet6Address("::5555:6666:7777:8888:"), "IPV6 ::5555:6666:7777:8888: should be invalid");
     608        assertFalse(validator.isValidInet6Address("1111:2222::4444:5555:6666:7777:8888:"), "IPV6 1111:2222::4444:5555:6666:7777:8888: should be invalid");
     609        assertFalse(validator.isValidInet6Address("1111::4444:5555:6666:7777:8888:"), "IPV6 1111::4444:5555:6666:7777:8888: should be invalid");
     610        assertFalse(validator.isValidInet6Address("::4444:5555:6666:7777:8888:"), "IPV6 ::4444:5555:6666:7777:8888: should be invalid");
     611        assertFalse(validator.isValidInet6Address("1111::3333:4444:5555:6666:7777:8888:"), "IPV6 1111::3333:4444:5555:6666:7777:8888: should be invalid");
     612        assertFalse(validator.isValidInet6Address("::3333:4444:5555:6666:7777:8888:"), "IPV6 ::3333:4444:5555:6666:7777:8888: should be invalid");
     613        assertFalse(validator.isValidInet6Address("::2222:3333:4444:5555:6666:7777:8888:"), "IPV6 ::2222:3333:4444:5555:6666:7777:8888: should be invalid");
     614        assertTrue(validator.isValidInet6Address("0:a:b:c:d:e:f::"), "IPV6 0:a:b:c:d:e:f:: should be valid");
     615        assertTrue(validator.isValidInet6Address("::0:a:b:c:d:e:f"), "IPV6 ::0:a:b:c:d:e:f should be valid"); // syntactically correct, but bad form (::0:... could be combined)
     616        assertTrue(validator.isValidInet6Address("a:b:c:d:e:f:0::"), "IPV6 a:b:c:d:e:f:0:: should be valid");
     617        assertFalse(validator.isValidInet6Address("':10.0.0.1"), "IPV6 ':10.0.0.1 should be invalid");
    619618    }
    620619    // CHECKSTYLE.ON: ExecutableStatementCount
  • trunk/test/unit/org/openstreetmap/josm/data/validation/routines/RegexValidatorTest.java

    r17275 r18690  
    1717package org.openstreetmap.josm.data.validation.routines;
    1818
    19 import static org.junit.Assert.assertEquals;
    20 import static org.junit.Assert.assertFalse;
    21 import static org.junit.Assert.assertNull;
    22 import static org.junit.Assert.assertTrue;
    23 import static org.junit.jupiter.api.Assertions.fail;
    24 
    25 import java.util.Arrays;
     19import static org.junit.jupiter.api.Assertions.assertArrayEquals;
     20import static org.junit.jupiter.api.Assertions.assertEquals;
     21import static org.junit.jupiter.api.Assertions.assertFalse;
     22import static org.junit.jupiter.api.Assertions.assertNull;
     23import static org.junit.jupiter.api.Assertions.assertThrows;
     24import static org.junit.jupiter.api.Assertions.assertTrue;
     25
    2626import java.util.regex.PatternSyntaxException;
    2727
     
    6060
    6161        // isValid()
    62         assertTrue("Sensitive isValid() valid",      sensitive.isValid("ac-DE-1"));
    63         assertFalse("Sensitive isValid() invalid",   sensitive.isValid("AB-de-1"));
    64         assertTrue("Insensitive isValid() valid",    insensitive.isValid("AB-de-1"));
    65         assertFalse("Insensitive isValid() invalid", insensitive.isValid("ABd-de-1"));
     62        assertTrue(sensitive.isValid("ac-DE-1"), "Sensitive isValid() valid");
     63        assertFalse(sensitive.isValid("AB-de-1"), "Sensitive isValid() invalid");
     64        assertTrue(insensitive.isValid("AB-de-1"), "Insensitive isValid() valid");
     65        assertFalse(insensitive.isValid("ABd-de-1"), "Insensitive isValid() invalid");
    6666
    6767        // validate()
    68         assertEquals("Sensitive validate() valid",   "acDE1", sensitive.validate("ac-DE-1"));
    69         assertNull("Sensitive validate() invalid",   sensitive.validate("AB-de-1"));
    70         assertEquals("Insensitive validate() valid", "ABde1", insensitive.validate("AB-de-1"));
    71         assertNull("Insensitive validate() invalid", insensitive.validate("ABd-de-1"));
     68        assertEquals("acDE1", sensitive.validate("ac-DE-1"), "Sensitive validate() valid");
     69        assertNull(sensitive.validate("AB-de-1"), "Sensitive validate() invalid");
     70        assertEquals("ABde1", insensitive.validate("AB-de-1"), "Insensitive validate() valid");
     71        assertNull(insensitive.validate("ABd-de-1"), "Insensitive validate() invalid");
    7272
    7373        // match()
    74         checkArray("Sensitive match() valid",     new String[] {"ac", "DE", "1"}, sensitive.match("ac-DE-1"));
    75         checkArray("Sensitive match() invalid",   null,                           sensitive.match("AB-de-1"));
    76         checkArray("Insensitive match() valid",   new String[] {"AB", "de", "1"}, insensitive.match("AB-de-1"));
    77         checkArray("Insensitive match() invalid", null,                           insensitive.match("ABd-de-1"));
    78         assertEquals("validate one", "ABC", (new RegexValidator("^([A-Z]*)$")).validate("ABC"));
    79         checkArray("match one", new String[] {"ABC"}, (new RegexValidator("^([A-Z]*)$")).match("ABC"));
     74        String[] result2 = sensitive.match("ac-DE-1");
     75        assertArrayEquals(new String[] {"ac", "DE", "1"}, result2, "Sensitive match() valid");
     76        assertNull(sensitive.match("AB-de-1"), "Sensitive match() invalid");
     77        String[] result1 = insensitive.match("AB-de-1");
     78        assertArrayEquals(new String[] {"AB", "de", "1"}, result1, "Insensitive match() valid");
     79        assertNull(insensitive.match("ABd-de-1"), "Insensitive match() invalid");
     80        assertEquals("ABC", (new RegexValidator("^([A-Z]*)$")).validate("ABC"), "validate one");
     81        String[] result = (new RegexValidator("^([A-Z]*)$")).match("ABC");
     82        assertArrayEquals(new String[] {"ABC"}, result, "match one");
    8083    }
    8184
     
    98101
    99102        // isValid()
    100         assertTrue("Sensitive isValid() Multiple", multiple.isValid(value));
    101         assertFalse("Sensitive isValid() 1st",     single1.isValid(value));
    102         assertTrue("Sensitive isValid() 2nd",      single2.isValid(value));
    103         assertFalse("Sensitive isValid() 3rd",     single3.isValid(value));
     103        assertTrue(multiple.isValid(value), "Sensitive isValid() Multiple");
     104        assertFalse(single1.isValid(value), "Sensitive isValid() 1st");
     105        assertTrue(single2.isValid(value), "Sensitive isValid() 2nd");
     106        assertFalse(single3.isValid(value), "Sensitive isValid() 3rd");
    104107
    105108        // validate()
    106         assertEquals("Sensitive validate() Multiple", expect, multiple.validate(value));
    107         assertNull("Sensitive validate() 1st",        single1.validate(value));
    108         assertEquals("Sensitive validate() 2nd",      expect, single2.validate(value));
    109         assertNull("Sensitive validate() 3rd",        single3.validate(value));
     109        assertEquals(expect, multiple.validate(value), "Sensitive validate() Multiple");
     110        assertNull(single1.validate(value), "Sensitive validate() 1st");
     111        assertEquals(expect, single2.validate(value), "Sensitive validate() 2nd");
     112        assertNull(single3.validate(value), "Sensitive validate() 3rd");
    110113
    111114        // match()
    112         checkArray("Sensitive match() Multiple", array, multiple.match(value));
    113         checkArray("Sensitive match() 1st",      null,  single1.match(value));
    114         checkArray("Sensitive match() 2nd",      array, single2.match(value));
    115         checkArray("Sensitive match() 3rd",      null,  single3.match(value));
     115        assertArrayEquals(array, multiple.match(value), "Sensitive match() Multiple");
     116        assertNull(single1.match(value), "Sensitive match() 1st");
     117        assertArrayEquals(array, single2.match(value), "Sensitive match() 2nd");
     118        assertNull(single3.match(value), "Sensitive match() 3rd");
    116119
    117120        // All invalid
    118121        value = "AAC*FDE*321";
    119         assertFalse("isValid() Invalid", multiple.isValid(value));
    120         assertNull("validate() Invalid", multiple.validate(value));
    121         assertNull("match() Multiple",   multiple.match(value));
     122        assertFalse(multiple.isValid(value), "isValid() Invalid");
     123        assertNull(multiple.validate(value), "validate() Invalid");
     124        assertNull(multiple.match(value), "match() Multiple");
    122125    }
    123126
     
    140143
    141144        // isValid()
    142         assertTrue("isValid() Multiple", multiple.isValid(value));
    143         assertFalse("isValid() 1st",     single1.isValid(value));
    144         assertTrue("isValid() 2nd",      single2.isValid(value));
    145         assertFalse("isValid() 3rd",     single3.isValid(value));
     145        assertTrue(multiple.isValid(value), "isValid() Multiple");
     146        assertFalse(single1.isValid(value), "isValid() 1st");
     147        assertTrue(single2.isValid(value), "isValid() 2nd");
     148        assertFalse(single3.isValid(value), "isValid() 3rd");
    146149
    147150        // validate()
    148         assertEquals("validate() Multiple", expect, multiple.validate(value));
    149         assertNull("validate() 1st",        single1.validate(value));
    150         assertEquals("validate() 2nd",      expect, single2.validate(value));
    151         assertNull("validate() 3rd",        single3.validate(value));
     151        assertEquals(expect, multiple.validate(value), "validate() Multiple");
     152        assertNull(single1.validate(value), "validate() 1st");
     153        assertEquals(expect, single2.validate(value), "validate() 2nd");
     154        assertNull(single3.validate(value), "validate() 3rd");
    152155
    153156        // match()
    154         checkArray("match() Multiple", array, multiple.match(value));
    155         checkArray("match() 1st",      null,  single1.match(value));
    156         checkArray("match() 2nd",      array, single2.match(value));
    157         checkArray("match() 3rd",      null,  single3.match(value));
     157        assertArrayEquals(array, multiple.match(value), "match() Multiple");
     158        assertNull(single1.match(value), "match() 1st");
     159        assertArrayEquals(array, single2.match(value), "match() 2nd");
     160        assertNull(single3.match(value), "match() 3rd");
    158161
    159162        // All invalid
    160163        value = "AAC*FDE*321";
    161         assertFalse("isValid() Invalid", multiple.isValid(value));
    162         assertNull("validate() Invalid", multiple.validate(value));
    163         assertNull("match() Multiple",   multiple.match(value));
     164        assertFalse(multiple.isValid(value), "isValid() Invalid");
     165        assertNull(multiple.validate(value), "validate() Invalid");
     166        assertNull(multiple.match(value), "match() Multiple");
    164167    }
    165168
     
    170173    void testNullValue() {
    171174        RegexValidator validator = new RegexValidator(REGEX);
    172         assertFalse("Instance isValid()", validator.isValid(null));
    173         assertNull("Instance validate()", validator.validate(null));
    174         assertNull("Instance match()",    validator.match(null));
     175        assertFalse(validator.isValid(null), "Instance isValid()");
     176        assertNull(validator.validate(null), "Instance validate()");
     177        assertNull(validator.match(null), "Instance match()");
    175178    }
    176179
     
    182185    @Test
    183186    void testMissingRegex() {
    184 
    185187        // Single Regular Expression - null
    186         try {
    187             new RegexValidator((String) null);
    188             fail("Single Null - expected IllegalArgumentException");
    189         } catch (IllegalArgumentException e) {
    190             assertEquals("Single Null", "Regular expression[0] is missing", e.getMessage());
    191         }
     188        IllegalArgumentException iae = assertThrows(IllegalArgumentException.class, () -> new RegexValidator((String) null),
     189                "Single Null - expected IllegalArgumentException");
     190        assertEquals("Regular expression[0] is missing", iae.getMessage(), "Single Null");
    192191
    193192        // Single Regular Expression - Zero Length
    194         try {
    195             new RegexValidator("");
    196             fail("Single Zero Length - expected IllegalArgumentException");
    197         } catch (IllegalArgumentException e) {
    198             assertEquals("Single Zero Length", "Regular expression[0] is missing", e.getMessage());
    199         }
     193        iae = assertThrows(IllegalArgumentException.class, () -> new RegexValidator(""),
     194                "Single Zero Length - expected IllegalArgumentException");
     195        assertEquals("Regular expression[0] is missing", iae.getMessage(), "Single Zero Length");
    200196
    201197        // Multiple Regular Expression - Null array
    202         try {
    203             new RegexValidator((String[]) null);
    204             fail("Null Array - expected IllegalArgumentException");
    205         } catch (IllegalArgumentException e) {
    206             assertEquals("Null Array", "Regular expressions are missing", e.getMessage());
    207         }
     198        iae = assertThrows(IllegalArgumentException.class, () -> new RegexValidator((String[]) null),
     199                "Null Array - expected IllegalArgumentException");
     200        assertEquals("Regular expressions are missing", iae.getMessage(), "Null Array");
    208201
    209202        // Multiple Regular Expression - Zero Length array
    210         try {
    211             new RegexValidator(new String[0]);
    212             fail("Zero Length Array - expected IllegalArgumentException");
    213         } catch (IllegalArgumentException e) {
    214             assertEquals("Zero Length Array", "Regular expressions are missing", e.getMessage());
    215         }
     203        iae = assertThrows(IllegalArgumentException.class, RegexValidator::new,
     204                "Zero Length Array - expected IllegalArgumentException");
     205        assertEquals("Regular expressions are missing", iae.getMessage(), "Zero Length Array");
    216206
    217207        // Multiple Regular Expression - Array has Null
    218         String[] expressions = new String[] {"ABC", null};
    219         try {
    220             new RegexValidator(expressions);
    221             fail("Array has Null - expected IllegalArgumentException");
    222         } catch (IllegalArgumentException e) {
    223             assertEquals("Array has Null", "Regular expression[1] is missing", e.getMessage());
    224         }
     208        iae = assertThrows(IllegalArgumentException.class, () -> new RegexValidator("ABC", null),
     209                "Array has Null - expected IllegalArgumentException");
     210        assertEquals("Regular expression[1] is missing", iae.getMessage(), "Array has Null");
    225211
    226212        // Multiple Regular Expression - Array has Zero Length
    227         expressions = new String[] {"", "ABC"};
    228         try {
    229             new RegexValidator(expressions);
    230             fail("Array has Zero Length - expected IllegalArgumentException");
    231         } catch (IllegalArgumentException e) {
    232             assertEquals("Array has Zero Length", "Regular expression[0] is missing", e.getMessage());
    233         }
     213        iae = assertThrows(IllegalArgumentException.class, () -> new RegexValidator("", "ABC"),
     214                "Array has Zero Length - expected IllegalArgumentException");
     215        assertEquals("Regular expression[0] is missing", iae.getMessage(), "Array has Zero Length");
    234216    }
    235217
     
    254236    void testToString() {
    255237        RegexValidator single = new RegexValidator(REGEX);
    256         assertEquals("Single", "RegexValidator{" + REGEX + "}", single.toString());
    257 
    258         RegexValidator multiple = new RegexValidator(new String[] {REGEX, REGEX});
    259         assertEquals("Multiple", "RegexValidator{" + REGEX + "," + REGEX + "}", multiple.toString());
     238        assertEquals("RegexValidator{" + REGEX + "}", single.toString(), "Single");
     239
     240        RegexValidator multiple = new RegexValidator(REGEX, REGEX);
     241        assertEquals("RegexValidator{" + REGEX + "," + REGEX + "}", multiple.toString(), "Multiple");
    260242    }
    261243
     
    268250    }
    269251
    270     /**
    271      * Compare two arrays
    272      * @param label Label for the test
    273      * @param expect Expected array
    274      * @param result Actual array
    275      */
    276     private void checkArray(String label, String[] expect, String[] result) {
    277 
    278         // Handle nulls
    279         if (expect == null || result == null) {
    280             if (expect == null && result == null) {
    281                 return; // valid, both null
    282             } else {
    283                 fail(label + " Null expect=" + Arrays.toString(expect) + " result=" + Arrays.toString(result));
    284             }
    285             return; // not strictly necessary, but prevents possible NPE below
    286         }
    287 
    288         // Check Length
    289         if (expect.length != result.length) {
    290             fail(label + " Length expect=" + expect.length + " result=" + result.length);
    291         }
    292 
    293         // Check Values
    294         for (int i = 0; i < expect.length; i++) {
    295             assertEquals(label +" value[" + i + "]", expect[i], result[i]);
    296         }
    297     }
    298252}
  • trunk/test/unit/org/openstreetmap/josm/data/validation/routines/UrlValidatorTest.java

    r17381 r18690  
    1717package org.openstreetmap.josm.data.validation.routines;
    1818
    19 import static org.junit.Assert.assertEquals;
    20 import static org.junit.Assert.assertFalse;
    21 import static org.junit.Assert.assertTrue;
     19import static org.junit.jupiter.api.Assertions.assertEquals;
     20import static org.junit.jupiter.api.Assertions.assertFalse;
     21import static org.junit.jupiter.api.Assertions.assertTrue;
    2222
    2323import org.junit.jupiter.api.BeforeEach;
     
    4848     */
    4949    @Test
    50     public void testIsValid() {
     50    void testIsValid() {
    5151        testIsValid(testUrlParts, UrlValidator.ALLOW_ALL_SCHEMES);
    5252        setUp();
     
    6363     */
    6464    @Test
    65     public void testIsValidScheme() {
     65    void testIsValidScheme() {
    6666        if (printStatus) {
    6767            System.out.print("\n testIsValidScheme() ");
     
    7171        for (ResultPair testPair : testScheme) {
    7272            boolean result = urlVal.isValidScheme(testPair.item);
    73             assertEquals(testPair.item, testPair.valid, result);
     73            assertEquals(testPair.valid, result, testPair.item);
    7474            if (printStatus) {
    7575                if (result == testPair.valid) {
     
    112112            String url = testBuffer.toString();
    113113            boolean result = urlVal.isValid(url);
    114             assertEquals(url, expected, result);
     114            assertEquals(expected, result, url);
    115115            if (printStatus) {
    116116                if (printIndex) {
     
    164164    void testValidator218() {
    165165        UrlValidator validator = new UrlValidator(UrlValidator.ALLOW_2_SLASHES);
    166         assertTrue("parentheses should be valid in URLs",
    167                 validator.isValid("http://somewhere.com/pathxyz/file(1).html"));
     166        assertTrue(validator.isValid("http://somewhere.com/pathxyz/file(1).html"), "parentheses should be valid in URLs");
    168167    }
    169168
     
    179178        }
    180179        UrlValidator validator = new UrlValidator();
    181         assertTrue("xn--d1abbgf6aiiy.xn--p1ai should validate", validator.isValid("http://xn--d1abbgf6aiiy.xn--p1ai"));
    182         assertTrue("президент.рф should validate", validator.isValid("http://президент.рф"));
    183         assertTrue("www.b\u00fccher.ch should validate", validator.isValid("http://www.b\u00fccher.ch"));
    184         assertFalse("www.\uFFFD.ch FFFD should fail", validator.isValid("http://www.\uFFFD.ch"));
    185         assertTrue("www.b\u00fccher.ch should validate", validator.isValid("ftp://www.b\u00fccher.ch"));
    186         assertFalse("www.\uFFFD.ch FFFD should fail", validator.isValid("ftp://www.\uFFFD.ch"));
     180        assertTrue(validator.isValid("http://xn--d1abbgf6aiiy.xn--p1ai"), "xn--d1abbgf6aiiy.xn--p1ai should validate");
     181        assertTrue(validator.isValid("http://президент.рф"), "президент.рф should validate");
     182        assertTrue(validator.isValid("http://www.b\u00fccher.ch"), "www.b\u00fccher.ch should validate");
     183        assertFalse(validator.isValid("http://www.\uFFFD.ch"), "www.\uFFFD.ch FFFD should fail");
     184        assertTrue(validator.isValid("ftp://www.b\u00fccher.ch"), "www.b\u00fccher.ch should validate");
     185        assertFalse(validator.isValid("ftp://www.\uFFFD.ch"), "www.\uFFFD.ch FFFD should fail");
    187186    }
    188187
     
    195194        UrlValidator validator = new UrlValidator(regex, 0);
    196195
    197         assertTrue("localhost URL should validate",
    198                 validator.isValid("http://localhost/test/index.html"));
    199         assertTrue("first.my-testing should validate",
    200                 validator.isValid("http://first.my-testing/test/index.html"));
    201         assertTrue("sup3r.my-testing should validate",
    202                 validator.isValid("http://sup3r.my-testing/test/index.html"));
    203 
    204         assertFalse("broke.my-test should not validate",
    205                 validator.isValid("http://broke.my-test/test/index.html"));
    206 
    207         assertTrue("www.apache.org should still validate",
    208                 validator.isValid("http://www.apache.org/test/index.html"));
     196        assertTrue(validator.isValid("http://localhost/test/index.html"), "localhost URL should validate");
     197        assertTrue(validator.isValid("http://first.my-testing/test/index.html"), "first.my-testing should validate");
     198        assertTrue(validator.isValid("http://sup3r.my-testing/test/index.html"), "sup3r.my-testing should validate");
     199
     200        assertFalse(validator.isValid("http://broke.my-test/test/index.html"), "broke.my-test should not validate");
     201
     202        assertTrue(validator.isValid("http://www.apache.org/test/index.html"), "www.apache.org should still validate");
    209203
    210204        // Now check using options
    211205        validator = new UrlValidator(UrlValidator.ALLOW_LOCAL_URLS);
    212206
    213         assertTrue("localhost URL should validate",
    214                 validator.isValid("http://localhost/test/index.html"));
    215 
    216         assertTrue("machinename URL should validate",
    217                 validator.isValid("http://machinename/test/index.html"));
    218 
    219         assertTrue("www.apache.org should still validate",
    220                 validator.isValid("http://www.apache.org/test/index.html"));
     207        assertTrue(validator.isValid("http://localhost/test/index.html"), "localhost URL should validate");
     208
     209        assertTrue(validator.isValid("http://machinename/test/index.html"), "machinename URL should validate");
     210
     211        assertTrue(validator.isValid("http://www.apache.org/test/index.html"), "www.apache.org should still validate");
    221212    }
    222213
     
    228219        UrlValidator validator = new UrlValidator(UrlValidator.ALLOW_LOCAL_URLS);
    229220
    230         assertTrue("hostname should validate",
    231                 validator.isValid("http://hostname"));
    232 
    233         assertTrue("hostname with path should validate",
    234                 validator.isValid("http://hostname/test/index.html"));
    235 
    236         assertTrue("localhost URL should validate",
    237                 validator.isValid("http://localhost/test/index.html"));
    238 
    239         assertFalse("first.my-testing should not validate",
    240                 validator.isValid("http://first.my-testing/test/index.html"));
    241 
    242         assertFalse("broke.hostname should not validate",
    243                 validator.isValid("http://broke.hostname/test/index.html"));
    244 
    245         assertTrue("www.apache.org should still validate",
    246                 validator.isValid("http://www.apache.org/test/index.html"));
     221        assertTrue(validator.isValid("http://hostname"), "hostname should validate");
     222
     223        assertTrue(validator.isValid("http://hostname/test/index.html"), "hostname with path should validate");
     224
     225        assertTrue(validator.isValid("http://localhost/test/index.html"), "localhost URL should validate");
     226
     227        assertFalse(validator.isValid("http://first.my-testing/test/index.html"), "first.my-testing should not validate");
     228
     229        assertFalse(validator.isValid("http://broke.hostname/test/index.html"), "broke.hostname should not validate");
     230
     231        assertTrue(validator.isValid("http://www.apache.org/test/index.html"), "www.apache.org should still validate");
    247232
    248233        // Turn it off, and check
    249234        validator = new UrlValidator(0);
    250235
    251         assertFalse("hostname should no longer validate",
    252                 validator.isValid("http://hostname"));
    253 
    254         assertFalse("localhost URL should no longer validate",
    255                 validator.isValid("http://localhost/test/index.html"));
    256 
    257         assertTrue("www.apache.org should still validate",
    258                 validator.isValid("http://www.apache.org/test/index.html"));
     236        assertFalse(validator.isValid("http://hostname"), "hostname should no longer validate");
     237
     238        assertFalse(validator.isValid("http://localhost/test/index.html"), "localhost URL should no longer validate");
     239
     240        assertTrue(validator.isValid("http://www.apache.org/test/index.html"), "www.apache.org should still validate");
    259241    }
    260242
     
    267249        UrlValidator validator = new UrlValidator();
    268250
    269         assertTrue("http://apache.org/ should be allowed by default",
    270                 validator.isValid("http://www.apache.org/test/index.html"));
    271 
    272         assertFalse("file:///c:/ shouldn't be allowed by default",
    273                 validator.isValid("file:///C:/some.file"));
    274 
    275         assertFalse("file:///c:\\ shouldn't be allowed by default",
    276                 validator.isValid("file:///C:\\some.file"));
    277 
    278         assertFalse("file:///etc/ shouldn't be allowed by default",
    279                 validator.isValid("file:///etc/hosts"));
    280 
    281         assertFalse("file://localhost/etc/ shouldn't be allowed by default",
    282                 validator.isValid("file://localhost/etc/hosts"));
    283 
    284         assertFalse("file://localhost/c:/ shouldn't be allowed by default",
    285                 validator.isValid("file://localhost/c:/some.file"));
     251        assertTrue(validator.isValid("http://www.apache.org/test/index.html"), "http://apache.org/ should be allowed by default");
     252
     253        assertFalse(validator.isValid("file:///C:/some.file"), "file:///c:/ shouldn't be allowed by default");
     254
     255        assertFalse(validator.isValid("file:///C:\\some.file"), "file:///c:\\ shouldn't be allowed by default");
     256
     257        assertFalse(validator.isValid("file:///etc/hosts"), "file:///etc/ shouldn't be allowed by default");
     258
     259        assertFalse(validator.isValid("file://localhost/etc/hosts"), "file://localhost/etc/ shouldn't be allowed by default");
     260
     261        assertFalse(validator.isValid("file://localhost/c:/some.file"), "file://localhost/c:/ shouldn't be allowed by default");
    286262
    287263        // Turn it on, and check
     
    289265        validator = new UrlValidator(new String[]{"http", "file"}, UrlValidator.ALLOW_LOCAL_URLS);
    290266
    291         assertTrue("http://apache.org/ should be allowed by default",
    292                 validator.isValid("http://www.apache.org/test/index.html"));
    293 
    294         assertTrue("file:///c:/ should now be allowed",
    295                 validator.isValid("file:///C:/some.file"));
     267        assertTrue(validator.isValid("http://www.apache.org/test/index.html"), "http://apache.org/ should be allowed by default");
     268
     269        assertTrue(validator.isValid("file:///C:/some.file"), "file:///c:/ should now be allowed");
    296270
    297271        // Currently, we don't support the c:\ form
    298         assertFalse("file:///c:\\ shouldn't be allowed",
    299                 validator.isValid("file:///C:\\some.file"));
    300 
    301         assertTrue("file:///etc/ should now be allowed",
    302                 validator.isValid("file:///etc/hosts"));
    303 
    304         assertTrue("file://localhost/etc/ should now be allowed",
    305                 validator.isValid("file://localhost/etc/hosts"));
    306 
    307         assertTrue("file://localhost/c:/ should now be allowed",
    308                 validator.isValid("file://localhost/c:/some.file"));
     272        assertFalse(validator.isValid("file:///C:\\some.file"), "file:///c:\\ shouldn't be allowed");
     273
     274        assertTrue(validator.isValid("file:///etc/hosts"), "file:///etc/ should now be allowed");
     275
     276        assertTrue(validator.isValid("file://localhost/etc/hosts"), "file://localhost/etc/ should now be allowed");
     277
     278        assertTrue(validator.isValid("file://localhost/c:/some.file"), "file://localhost/c:/ should now be allowed");
    309279
    310280        // These are never valid
    311         assertFalse("file://c:/ shouldn't ever be allowed, needs file:///c:/",
    312                 validator.isValid("file://C:/some.file"));
    313 
    314         assertFalse("file://c:\\ shouldn't ever be allowed, needs file:///c:/",
    315                 validator.isValid("file://C:\\some.file"));
     281        assertFalse(validator.isValid("file://C:/some.file"), "file://c:/ shouldn't ever be allowed, needs file:///c:/");
     282
     283        assertFalse(validator.isValid("file://C:\\some.file"), "file://c:\\ shouldn't ever be allowed, needs file:///c:/");
    316284    }
    317285
     
    406374     */
    407375    @Test
    408     public void testValidator290() {
     376    void testValidator290() {
    409377        UrlValidator validator = new UrlValidator();
    410378        assertTrue(validator.isValid("http://xn--h1acbxfam.idn.icann.org/"));
     
    447415     */
    448416    @Test
    449     public void testValidator361() {
     417    void testValidator361() {
    450418        UrlValidator validator = new UrlValidator();
    451419        assertTrue(validator.isValid("http://hello.tokyo/"));
     
    456424     */
    457425    @Test
    458     public void testValidator363() {
     426    void testValidator363() {
    459427        UrlValidator urlValidator = new UrlValidator();
    460428        assertTrue(urlValidator.isValid("http://www.example.org/a/b/hello..world"));
     
    480448     */
    481449    @Test
    482     public void testValidator375() {
     450    void testValidator375() {
    483451        UrlValidator validator = new UrlValidator();
    484452        String url = "http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html";
    485         assertTrue("IPv6 address URL should validate: " + url, validator.isValid(url));
     453        assertTrue(validator.isValid(url), "IPv6 address URL should validate: " + url);
    486454        url = "http://[::1]:80/index.html";
    487         assertTrue("IPv6 address URL should validate: " + url, validator.isValid(url));
     455        assertTrue(validator.isValid(url), "IPv6 address URL should validate: " + url);
    488456        url = "http://FEDC:BA98:7654:3210:FEDC:BA98:7654:3210:80/index.html";
    489         assertFalse("IPv6 address without [] should not validate: " + url, validator.isValid(url));
     457        assertFalse(validator.isValid(url), "IPv6 address without [] should not validate: " + url);
    490458    }
    491459
     
    494462     */
    495463    @Test
    496     public void testValidator353() { // userinfo
     464    void testValidator353() { // userinfo
    497465        UrlValidator validator = new UrlValidator();
    498466        assertTrue(validator.isValid("http://www.apache.org:80/path"));
     
    510478     */
    511479    @Test
    512     public void testValidator382() {
     480    void testValidator382() {
    513481        UrlValidator validator = new UrlValidator();
    514482        assertTrue(validator.isValid("ftp://username:password@example.com:8042/over/there/index.dtb?type=animal&name=narwhal#nose"));
     
    519487     */
    520488    @Test
    521     public void testValidator380() {
     489    void testValidator380() {
    522490        UrlValidator validator = new UrlValidator();
    523491        assertTrue(validator.isValid("http://www.apache.org:80/path"));
     
    530498     */
    531499    @Test
    532     public void testValidatorName() {
     500    void testValidatorName() {
    533501        assertEquals("URL validator", UrlValidator.getInstance().getValidatorName());
    534502    }
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/ConnectivityRelationsTest.java

    r17384 r18690  
    22package org.openstreetmap.josm.data.validation.tests;
    33
    4 import org.junit.Assert;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5
    56import org.junit.jupiter.api.BeforeEach;
    67import org.junit.jupiter.api.Test;
     
    3233
    3334    @BeforeEach
    34     public void setUpCheck() throws Exception {
     35    public void setUpCheck() {
    3536        check = new ConnectivityRelations();
    3637    }
     
    5253        check.visit(relation);
    5354
    54         Assert.assertEquals(0, check.getErrors().size());
     55        assertEquals(0, check.getErrors().size());
    5556
    5657        relation.remove(CONNECTIVITY);
    5758        check.visit(relation);
    58         Assert.assertEquals(1, check.getErrors().size());
     59        assertEquals(1, check.getErrors().size());
    5960    }
    6061
     
    6869        int expectedFailures = 0;
    6970
    70         Assert.assertEquals(expectedFailures, check.getErrors().size());
     71        assertEquals(expectedFailures, check.getErrors().size());
    7172
    7273        relation.put(CONNECTIVITY, "45000:1");
    7374        check.visit(relation);
    74         Assert.assertEquals(++expectedFailures, check.getErrors().size());
     75        assertEquals(++expectedFailures, check.getErrors().size());
    7576
    7677        relation.put(CONNECTIVITY, "1:45000");
    7778        check.visit(relation);
    78         Assert.assertEquals(++expectedFailures, check.getErrors().size());
     79        assertEquals(++expectedFailures, check.getErrors().size());
    7980
    8081        relation.put(CONNECTIVITY, "1:1,2");
    8182        check.visit(relation);
    82         Assert.assertEquals(expectedFailures, check.getErrors().size());
     83        assertEquals(expectedFailures, check.getErrors().size());
    8384
    8485        relation.put(CONNECTIVITY, "1:1,(2)");
    8586        check.visit(relation);
    86         Assert.assertEquals(expectedFailures, check.getErrors().size());
     87        assertEquals(expectedFailures, check.getErrors().size());
    8788
    8889        relation.put(CONNECTIVITY, "1:1,(20000)");
    8990        check.visit(relation);
    90         Assert.assertEquals(++expectedFailures, check.getErrors().size());
     91        assertEquals(++expectedFailures, check.getErrors().size());
    9192    }
    9293
    9394    /**
    9495     * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/201821">Bug #20182</a>.
    95      * @throws Exception if an error occurs
    9696     */
    9797    @Test
    98     void testTicket20182() throws Exception {
     98    void testTicket20182() {
    9999        Relation relation = createDefaultTestRelation();
    100100        check.visit(relation);
    101101        int expectedFailures = 0;
    102102
    103         Assert.assertEquals(expectedFailures, check.getErrors().size());
     103        assertEquals(expectedFailures, check.getErrors().size());
    104104
    105105        relation.put(CONNECTIVITY, "left_turn");
    106106        check.visit(relation);
    107         Assert.assertEquals(++expectedFailures, check.getErrors().size());
     107        assertEquals(++expectedFailures, check.getErrors().size());
    108108
    109109        relation.put(CONNECTIVITY, "1");
    110110        check.visit(relation);
    111         Assert.assertEquals(++expectedFailures, check.getErrors().size());
     111        assertEquals(++expectedFailures, check.getErrors().size());
    112112    }
    113113}
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/DirectionNodesTest.java

    r17413 r18690  
    44import org.junit.jupiter.api.Test;
    55import org.junit.jupiter.api.extension.RegisterExtension;
     6import org.openstreetmap.josm.data.osm.DataSet;
    67import org.openstreetmap.josm.testutils.JOSMTestRules;
    78
     
    2829    void testDirectionsNodesTestFile() throws Exception {
    2930        final DirectionNodes test = new DirectionNodes();
    30         ValidatorTestUtils.testSampleFile("nodist/data/direction-nodes.osm", ds -> ds.getNodes(), null, test);
     31        ValidatorTestUtils.testSampleFile("nodist/data/direction-nodes.osm", DataSet::getNodes, null, test);
    3132    }
    3233}
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MapCSSTagCheckerTest.java

    r17916 r18690  
    44import static org.junit.jupiter.api.Assertions.assertEquals;
    55import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertInstanceOf;
    67import static org.junit.jupiter.api.Assertions.assertNotNull;
    78import static org.junit.jupiter.api.Assertions.assertTrue;
     
    129130                "}")).parseChecks.get(0);
    130131        final Command command = check.fixPrimitive(p);
    131         assertTrue(command instanceof SequenceCommand);
     132        assertInstanceOf(SequenceCommand.class, command);
    132133        final Iterator<PseudoCommand> it = command.getChildren().iterator();
    133         assertTrue(it.next() instanceof ChangePropertyKeyCommand);
    134         assertTrue(it.next() instanceof ChangePropertyCommand);
     134        assertInstanceOf(ChangePropertyKeyCommand.class, it.next());
     135        assertInstanceOf(ChangePropertyCommand.class, it.next());
    135136    }
    136137
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/OpeningHourTestTest.java

    r18037 r18690  
    77import static org.hamcrest.MatcherAssert.assertThat;
    88import static org.junit.jupiter.api.Assertions.assertEquals;
     9import static org.junit.jupiter.api.Assertions.assertInstanceOf;
    910import static org.junit.jupiter.api.Assertions.assertNotNull;
    1011import static org.junit.jupiter.api.Assertions.assertTrue;
     
    258259    private static void assertFixEquals(String value, TestError error) {
    259260        assertNotNull(error.getFix(), "fix is not null");
    260         assertTrue(error.getFix() instanceof ChangePropertyCommand, "fix is ChangePropertyCommand");
    261         final ChangePropertyCommand command = (ChangePropertyCommand) error.getFix();
     261        final ChangePropertyCommand command = assertInstanceOf(ChangePropertyCommand.class, error.getFix(), "fix is ChangePropertyCommand");
    262262        assertEquals(1, command.getTags().size());
    263263        assertEquals(value, command.getTags().values().iterator().next());
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/SelfIntersectingWayTest.java

    r17275 r18690  
    22package org.openstreetmap.josm.data.validation.tests;
    33
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertTrue;
     6
    47import java.util.ArrayList;
     8import java.util.Arrays;
    59import java.util.List;
    610import java.util.stream.Collectors;
    711import java.util.stream.IntStream;
    812
    9 import org.junit.Assert;
    1013import org.junit.jupiter.api.BeforeAll;
    1114import org.junit.jupiter.api.Test;
     15import org.junit.jupiter.params.ParameterizedTest;
     16import org.junit.jupiter.params.provider.Arguments;
     17import org.junit.jupiter.params.provider.MethodSource;
    1218import org.openstreetmap.josm.JOSMFixture;
    1319import org.openstreetmap.josm.data.coor.LatLon;
     
    5965        SelfIntersectingWay test = new SelfIntersectingWay();
    6066        test.visit(w);
    61         Assert.assertEquals(1, test.getErrors().size());
    62         Assert.assertTrue(test.getErrors().iterator().next().getHighlighted().contains(nodes.get(1)));
    63     }
    64 
    65     /**
    66      * First node is identical to an inner node ("P"-Shape).
     67        assertEquals(1, test.getErrors().size());