Changeset 18690 in josm


Ignore:
Timestamp:
2023-03-13T21:59:27+01:00 (20 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());
     68        assertTrue(test.getErrors().iterator().next().getHighlighted().contains(nodes.get(1)));
     69    }
     70
     71    static List<Arguments> testOkInnerNode() {
     72        // The first two are duplicates
     73        return Arrays.asList(
     74                Arguments.of("testUnclosedWayFirst - First node is identical to an inner node (\"P\"-Shape)",
     75                        new int[] {0, 1, 2, 0 /* problem */, 3, 4}),
     76                Arguments.of("testUnclosedWayFirstRepeated - First node is identical to an inner node (\"P\"-Shape)",
     77                        new int[] {0, 1, 2, 0 /* problem */, 3, 4}),
     78                Arguments.of("testUnclosedWayLast - Last node is identical to an inner node (\"b\"-Shape)",
     79                        new int[] {0, 1 /* problem */, 2, 3, 4, 1})
     80        );
     81    }
     82
     83    /**
     84     * The starting or ending nodes are also an inner node.
    6785     * This is considered okay.
    6886     */
    69     @Test
    70     void testUnclosedWayFirst() {
     87    @ParameterizedTest(name = "{0}")
     88    @MethodSource("testOkInnerNode")
     89    void testUnclosedWayFirst(String description, int[] nodeIndex) {
     90        List<Node> nodes = createNodes();
     91
     92        Way w = (Way) OsmUtils.createPrimitive("way ");
     93        List<Node> wayNodes = new ArrayList<>(nodeIndex.length);
     94        for (int i : nodeIndex) {
     95            wayNodes.add(nodes.get(i));
     96        }
     97        w.setNodes(wayNodes);
     98        SelfIntersectingWay test = new SelfIntersectingWay();
     99        test.visit(w);
     100        assertEquals(0, test.getErrors().size());
     101    }
     102
     103    /**
     104     * Both endpoints join at one inner node ("8"-shape).
     105     * This is considered to be an error.
     106     */
     107    @Test
     108    void testClosedWay() {
    71109        List<Node> nodes = createNodes();
    72110
     
    79117        wayNodes.add(nodes.get(3));
    80118        wayNodes.add(nodes.get(4));
    81         w.setNodes(wayNodes);
    82         SelfIntersectingWay test = new SelfIntersectingWay();
    83         test.visit(w);
    84         Assert.assertEquals(0, test.getErrors().size());
    85     }
    86 
    87     /**
    88      * First node is identical to an inner node ("P"-Shape).
    89      * This is considered okay.
    90      */
    91     @Test
    92     void testUnclosedWayFirstRepeated() {
    93         List<Node> nodes = createNodes();
    94 
    95         Way w = (Way) OsmUtils.createPrimitive("way ");
    96         List<Node> wayNodes = new ArrayList<>();
    97         wayNodes.add(nodes.get(0));
    98         wayNodes.add(nodes.get(1));
    99         wayNodes.add(nodes.get(2));
    100         wayNodes.add(nodes.get(0));
    101         wayNodes.add(nodes.get(3));
    102         wayNodes.add(nodes.get(4));
    103         w.setNodes(wayNodes);
    104         SelfIntersectingWay test = new SelfIntersectingWay();
    105         test.visit(w);
    106         Assert.assertEquals(0, test.getErrors().size());
    107     }
    108 
    109     /**
    110      * Last node is identical to an inner node ("b"-Shape).
    111      * This is considered okay.
    112      */
    113     @Test
    114     void testUnclosedWayLast() {
    115         List<Node> nodes = createNodes();
    116 
    117         Way w = (Way) OsmUtils.createPrimitive("way ");
    118         List<Node> wayNodes = new ArrayList<>();
    119         wayNodes.add(nodes.get(0));
    120         wayNodes.add(nodes.get(1)); // problem node
    121         wayNodes.add(nodes.get(2));
    122         wayNodes.add(nodes.get(3));
    123         wayNodes.add(nodes.get(4));
    124         wayNodes.add(nodes.get(1));
    125         w.setNodes(wayNodes);
    126         SelfIntersectingWay test = new SelfIntersectingWay();
    127         test.visit(w);
    128         Assert.assertEquals(0, test.getErrors().size());
    129     }
    130 
    131     /**
    132      * Both endpoints join at one inner node ("8"-shape).
    133      * This is considered to be an error.
    134      */
    135     @Test
    136     void testClosedWay() {
    137         List<Node> nodes = createNodes();
    138 
    139         Way w = (Way) OsmUtils.createPrimitive("way ");
    140         List<Node> wayNodes = new ArrayList<>();
    141         wayNodes.add(nodes.get(0));
    142         wayNodes.add(nodes.get(1));
    143         wayNodes.add(nodes.get(2));
     119        wayNodes.add(nodes.get(0));
     120        w.setNodes(wayNodes);
     121        SelfIntersectingWay test = new SelfIntersectingWay();
     122        test.visit(w);
     123        assertEquals(1, test.getErrors().size());
     124        assertTrue(test.getErrors().iterator().next().getHighlighted().contains(nodes.get(0)));
     125    }
     126
     127    /**
     128     * Closed way contains a spike.
     129     * This is considered to be an error.
     130     */
     131    @Test
     132    void testSpikeWithStartInClosedWay() {
     133        List<Node> nodes = createNodes();
     134
     135        Way w = (Way) OsmUtils.createPrimitive("way ");
     136        List<Node> wayNodes = new ArrayList<>();
     137        wayNodes.add(nodes.get(0));
     138        wayNodes.add(nodes.get(1));
    144139        wayNodes.add(nodes.get(0)); // problem
    145140        wayNodes.add(nodes.get(3));
     
    149144        SelfIntersectingWay test = new SelfIntersectingWay();
    150145        test.visit(w);
    151         Assert.assertEquals(1, test.getErrors().size());
    152         Assert.assertTrue(test.getErrors().iterator().next().getHighlighted().contains(nodes.get(0)));
     146        assertEquals(1, test.getErrors().size());
     147        assertTrue(test.getErrors().iterator().next().getHighlighted().contains(nodes.get(0)));
    153148    }
    154149
     
    158153     */
    159154    @Test
    160     void testSpikeWithStartInClosedWay() {
    161         List<Node> nodes = createNodes();
    162 
    163         Way w = (Way) OsmUtils.createPrimitive("way ");
    164         List<Node> wayNodes = new ArrayList<>();
    165         wayNodes.add(nodes.get(0));
    166         wayNodes.add(nodes.get(1));
     155    void testSpikeWithEndInClosedWay() {
     156        List<Node> nodes = createNodes();
     157
     158        Way w = (Way) OsmUtils.createPrimitive("way ");
     159        List<Node> wayNodes = new ArrayList<>();
     160        wayNodes.add(nodes.get(0));
     161        wayNodes.add(nodes.get(1));
     162        wayNodes.add(nodes.get(2));
    167163        wayNodes.add(nodes.get(0)); // problem
    168164        wayNodes.add(nodes.get(3));
    169         wayNodes.add(nodes.get(4));
    170         wayNodes.add(nodes.get(0));
    171         w.setNodes(wayNodes);
    172         SelfIntersectingWay test = new SelfIntersectingWay();
    173         test.visit(w);
    174         Assert.assertEquals(1, test.getErrors().size());
    175         Assert.assertTrue(test.getErrors().iterator().next().getHighlighted().contains(nodes.get(0)));
     165        wayNodes.add(nodes.get(0));
     166        w.setNodes(wayNodes);
     167        SelfIntersectingWay test = new SelfIntersectingWay();
     168        test.visit(w);
     169        assertEquals(1, test.getErrors().size());
     170        assertTrue(test.getErrors().iterator().next().getHighlighted().contains(nodes.get(0)));
    176171    }
    177172
     
    181176     */
    182177    @Test
    183     void testSpikeWithEndInClosedWay() {
    184         List<Node> nodes = createNodes();
    185 
    186         Way w = (Way) OsmUtils.createPrimitive("way ");
    187         List<Node> wayNodes = new ArrayList<>();
    188         wayNodes.add(nodes.get(0));
    189         wayNodes.add(nodes.get(1));
    190         wayNodes.add(nodes.get(2));
    191         wayNodes.add(nodes.get(0)); // problem
    192         wayNodes.add(nodes.get(3));
    193         wayNodes.add(nodes.get(0));
    194         w.setNodes(wayNodes);
    195         SelfIntersectingWay test = new SelfIntersectingWay();
    196         test.visit(w);
    197         Assert.assertEquals(1, test.getErrors().size());
    198         Assert.assertTrue(test.getErrors().iterator().next().getHighlighted().contains(nodes.get(0)));
    199     }
    200 
    201     /**
    202      * Closed way contains a spike.
    203      * This is considered to be an error.
    204      */
    205     @Test
    206178    void testSpikeInClosedWay() {
    207179        List<Node> nodes = createNodes();
     
    218190        SelfIntersectingWay test = new SelfIntersectingWay();
    219191        test.visit(w);
    220         Assert.assertEquals(1, test.getErrors().size());
    221         Assert.assertTrue(test.getErrors().iterator().next().getHighlighted().contains(nodes.get(2)));
     192        assertEquals(1, test.getErrors().size());
     193        assertTrue(test.getErrors().iterator().next().getHighlighted().contains(nodes.get(2)));
    222194    }
    223195
     
    243215        SelfIntersectingWay test = new SelfIntersectingWay();
    244216        test.visit(w);
    245         Assert.assertEquals(1, test.getErrors().size());
    246         Assert.assertTrue(test.getErrors().iterator().next().getHighlighted().contains(nodes.get(3)));
     217        assertEquals(1, test.getErrors().size());
     218        assertTrue(test.getErrors().iterator().next().getHighlighted().contains(nodes.get(3)));
    247219    }
    248220
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/TagCheckerTest.java

    r18282 r18690  
    1111import java.util.stream.Collectors;
    1212
    13 import org.junit.Assert;
     13import org.junit.jupiter.api.Assertions;
    1414import org.junit.jupiter.api.Disabled;
    1515import org.junit.jupiter.api.Test;
     
    266266
    267267    private static void doTestUnwantedNonprintingControlCharacters(String s) {
    268         doTestUnwantedNonprintingControlCharacters(s, Assert::assertTrue, "");
     268        doTestUnwantedNonprintingControlCharacters(s, Assertions::assertTrue, "");
    269269    }
    270270
     
    276276    void testContainsRemoveUnwantedNonprintingControlCharacters() {
    277277        // Check empty string is handled
    278         doTestUnwantedNonprintingControlCharacters("", Assert::assertFalse, "");
     278        doTestUnwantedNonprintingControlCharacters("", Assertions::assertFalse, "");
    279279        // Check 65 ASCII control characters are removed, except new lines
    280280        for (char c = 0x0; c < 0x20; c++) {
     
    282282                doTestUnwantedNonprintingControlCharacters(Character.toString(c));
    283283            } else {
    284                 doTestUnwantedNonprintingControlCharacters(Character.toString(c), Assert::assertFalse, Character.toString(c));
     284                doTestUnwantedNonprintingControlCharacters(Character.toString(c), Assertions::assertFalse, Character.toString(c));
    285285            }
    286286        }
     
    298298            doTestUnwantedNonprintingControlCharacters(s);
    299299            doTestUnwantedNonprintingControlCharacters(s + s);
    300             doTestUnwantedNonprintingControlCharacters(s + 'a' + s, Assert::assertTrue, "a");
     300            doTestUnwantedNonprintingControlCharacters(s + 'a' + s, Assertions::assertTrue, "a");
    301301            final String ok = 'a' + s + 'b';
    302             doTestUnwantedNonprintingControlCharacters(ok, Assert::assertFalse, ok);
    303             doTestUnwantedNonprintingControlCharacters(s + ok, Assert::assertTrue, ok);
    304             doTestUnwantedNonprintingControlCharacters(ok + s, Assert::assertTrue, ok);
    305             doTestUnwantedNonprintingControlCharacters(s + ok + s, Assert::assertTrue, ok);
     302            doTestUnwantedNonprintingControlCharacters(ok, Assertions::assertFalse, ok);
     303            doTestUnwantedNonprintingControlCharacters(s + ok, Assertions::assertTrue, ok);
     304            doTestUnwantedNonprintingControlCharacters(ok + s, Assertions::assertTrue, ok);
     305            doTestUnwantedNonprintingControlCharacters(s + ok + s, Assertions::assertTrue, ok);
    306306        }
    307307    }
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/TurnRestrictionTestTest.java

    r17275 r18690  
    44import org.junit.jupiter.api.extension.RegisterExtension;
    55import org.junit.jupiter.api.Test;
     6import org.openstreetmap.josm.data.osm.DataSet;
    67import org.openstreetmap.josm.testutils.JOSMTestRules;
    78
     
    3031    void testTurnrestrictionFile() throws Exception {
    3132        ValidatorTestUtils.testSampleFile("nodist/data/restriction.osm",
    32                 ds -> ds.getRelations(),
     33                DataSet::getRelations,
    3334                name -> name.startsWith("E"), TURNRESTRICTION_TEST, RELATION_TEST);
    3435    }
  • trunk/test/unit/org/openstreetmap/josm/gui/MainApplicationTest.java

    r18602 r18690  
    55import static org.junit.jupiter.api.Assertions.assertEquals;
    66import static org.junit.jupiter.api.Assertions.assertFalse;
     7import static org.junit.jupiter.api.Assertions.assertInstanceOf;
    78import static org.junit.jupiter.api.Assertions.assertNotNull;
    89import static org.junit.jupiter.api.Assertions.assertNull;
     
    125126        try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
    126127            System.setOut(new PrintStream(baos));
    127             Thread t = new Thread() {
    128                 @Override
    129                 public void run() {
    130                     MainApplication.main(new String[] {arg});
    131                 }
    132             };
     128            Thread t = new Thread(() -> MainApplication.main(new String[] {arg}));
    133129            t.start();
    134130            t.join();
     
    229225                    .until(() -> !BugReportQueue.getInstance().exceptionHandlingInProgress());
    230226            assertNotNull(exceptionAtomicReference.get());
    231             assertTrue(exceptionAtomicReference.get() instanceof UnsupportedOperationException);
     227            assertInstanceOf(UnsupportedOperationException.class, exceptionAtomicReference.get());
    232228            // The LAF only resets on restart, so don't bother checking that it switched back in UIManager
    233229            assertEquals(LafPreference.LAF.getDefaultValue(), LafPreference.LAF.get());
     
    253249    void testPostConstructorProcessCmdLineEmpty() {
    254250        // Check the method accepts no arguments
    255         MainApplication.postConstructorProcessCmdLine(new ProgramArguments(new String[0]));
     251        MainApplication.postConstructorProcessCmdLine(new ProgramArguments());
    256252    }
    257253
    258254    private static void doTestPostConstructorProcessCmdLine(String download, String downloadGps, boolean gpx) {
    259255        assertNull(MainApplication.getLayerManager().getEditDataSet());
    260         for (Future<?> f : MainApplication.postConstructorProcessCmdLine(new ProgramArguments(new String[]{
    261                 "--download=" + download,
     256        for (Future<?> f : MainApplication.postConstructorProcessCmdLine(new ProgramArguments("--download=" + download,
    262257                "--downloadgps=" + downloadGps,
    263                 "--selection=type: node"}))) {
     258                "--selection=type: node"))) {
    264259            try {
    265260                f.get();
     
    314309    /**
    315310     * Unit test of {@link MainApplication#postConstructorProcessCmdLine} - nominal case with file names.
    316      * @throws MalformedURLException if an error occurs
    317      */
    318     @Test
    319     void testPostConstructorProcessCmdLineFilename() throws MalformedURLException {
     311     */
     312    @Test
     313    void testPostConstructorProcessCmdLineFilename() {
    320314        doTestPostConstructorProcessCmdLine(
    321315                Paths.get(TestUtils.getTestDataRoot() + "multipolygon.osm").toFile().getAbsolutePath(),
  • trunk/test/unit/org/openstreetmap/josm/gui/MapViewStateTest.java

    r17275 r18690  
    6565    @Test
    6666    void testGetCenter() {
    67         doTestGetCenter(s -> s.getCenter(), t -> t / 2d);
     67        doTestGetCenter(MapViewState::getCenter, t -> t / 2d);
    6868    }
    6969
  • trunk/test/unit/org/openstreetmap/josm/gui/NavigatableComponentTest.java

    r18574 r18690  
    101101        assertThat(component.getPoint2D((EastNorth) null), CustomMatchers.is(new Point2D.Double()));
    102102        Point2D shouldBeCenter = component.getPoint2D(component.getCenter());
    103         assertThat(shouldBeCenter, CustomMatchers.is(new Point2D.Double(WIDTH / 2, HEIGHT / 2)));
     103        assertThat(shouldBeCenter, CustomMatchers.is(new Point2D.Double(WIDTH / 2.0, HEIGHT / 2.0)));
    104104
    105105        EastNorth testPoint = component.getCenter().add(300 * component.getScale(), 200 * component.getScale());
    106106        Point2D testPointConverted = component.getPoint2D(testPoint);
    107         assertThat(testPointConverted, CustomMatchers.is(new Point2D.Double(WIDTH / 2 + 300, HEIGHT / 2 - 200)));
     107        assertThat(testPointConverted, CustomMatchers.is(new Point2D.Double(WIDTH / 2.0 + 300, HEIGHT / 2.0 - 200)));
    108108    }
    109109
  • trunk/test/unit/org/openstreetmap/josm/gui/TableCellRendererTest.java

    r17275 r18690  
    33
    44import static org.junit.jupiter.api.Assertions.assertNotNull;
     5import static org.junit.jupiter.api.Assertions.assertTrue;
    56
    67import java.lang.reflect.Constructor;
     
    1415import javax.swing.table.TableCellRenderer;
    1516
    16 import org.junit.Assert;
    1717import org.junit.jupiter.api.extension.RegisterExtension;
    1818import org.junit.jupiter.api.Test;
     
    6464    void testTableCellRenderer() throws ReflectiveOperationException {
    6565        Set<Class<? extends TableCellRenderer>> renderers = TestUtils.getJosmSubtypes(TableCellRenderer.class);
    66         Assert.assertTrue(renderers.size() >= 10); // if it finds less than 10 classes, something is broken
     66        assertTrue(renderers.size() >= 10); // if it finds less than 10 classes, something is broken
    6767        JTable tbl = new JTable(2, 2);
    6868        for (Class<? extends TableCellRenderer> klass : renderers) {
  • trunk/test/unit/org/openstreetmap/josm/gui/datatransfer/ClipboardUtilsTest.java

    r18037 r18690  
    5858
    5959        @Override
    60         public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException {
     60        public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException {
    6161            throw new UnsupportedFlavorException(flavor);
    6262        }
     
    8484
    8585        ClipboardUtils.copy(new SupportNothingTransferable());
    86         assertEquals(null, ClipboardUtils.getClipboardStringContent());
     86        assertNull(ClipboardUtils.getClipboardStringContent());
    8787    }
    8888
  • trunk/test/unit/org/openstreetmap/josm/gui/datatransfer/LayerTransferableTest.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.assertInstanceOf;
    67import static org.junit.jupiter.api.Assertions.assertSame;
    78import static org.junit.jupiter.api.Assertions.assertTrue;
     
    4748    @Test
    4849    void testLayerData() {
    49         Data data = new Data(manager, Arrays.<Layer>asList(layer1, layer2));
     50        Data data = new Data(manager, Arrays.asList(layer1, layer2));
    5051
    5152        // need to be identity
     
    6162    @Test
    6263    void testSupportedDataFlavor() {
    63         LayerTransferable transferable = new LayerTransferable(manager, Arrays.<Layer>asList(layer1, layer2));
     64        LayerTransferable transferable = new LayerTransferable(manager, Arrays.asList(layer1, layer2));
    6465
    6566        assertFalse(transferable.isDataFlavorSupported(DataFlavor.imageFlavor));
     
    7778    @Test
    7879    void testTransferData() throws Exception {
    79         LayerTransferable transferable = new LayerTransferable(manager, Arrays.<Layer>asList(layer1, layer2));
     80        LayerTransferable transferable = new LayerTransferable(manager, Arrays.asList(layer1, layer2));
    8081
    8182        Object object = transferable.getTransferData(LayerTransferable.LAYER_DATA);
    82         assertTrue(object instanceof Data);
    83         Data data = (Data) object;
     83        Data data = assertInstanceOf(Data.class, object);
    8484        assertSame(manager, data.getManager());
    8585        assertSame(layer1, data.getLayers().get(0));
     
    9292    @Test
    9393    void testTransferDataUnsupported() {
    94         LayerTransferable transferable = new LayerTransferable(manager, Arrays.<Layer>asList(layer1, layer2));
     94        LayerTransferable transferable = new LayerTransferable(manager, Arrays.asList(layer1, layer2));
    9595
    9696        assertThrows(UnsupportedFlavorException.class, () -> transferable.getTransferData(DataFlavor.imageFlavor));
  • trunk/test/unit/org/openstreetmap/josm/gui/datatransfer/PrimitiveTransferableTest.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.assertInstanceOf;
    67import static org.junit.jupiter.api.Assertions.assertThrows;
    78import static org.junit.jupiter.api.Assertions.assertTrue;
     
    6768        Collection<PrimitiveData> td = ((PrimitiveTransferData) pt.getTransferData(PrimitiveTransferData.DATA_FLAVOR)).getAll();
    6869        assertEquals(1, td.size());
    69         assertTrue(td.iterator().next() instanceof NodeData);
     70        assertInstanceOf(NodeData.class, td.iterator().next());
    7071
    7172
  • trunk/test/unit/org/openstreetmap/josm/gui/datatransfer/data/PrimitiveTagTransferDataTest.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
     
    910import java.util.Map;
    1011
     12import org.junit.jupiter.api.Test;
    1113import org.openstreetmap.josm.data.osm.Node;
    1214import org.openstreetmap.josm.data.osm.NodeData;
     
    1719import org.openstreetmap.josm.data.osm.WayData;
    1820import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
    19 
    20 import org.junit.jupiter.api.Test;
    2121
    2222/**
     
    109109        assertEquals(2, (int) stats.get(OsmPrimitiveType.NODE));
    110110        assertEquals(1, (int) stats.get(OsmPrimitiveType.WAY));
    111         assertEquals(null, stats.get(OsmPrimitiveType.RELATION));
     111        assertNull(stats.get(OsmPrimitiveType.RELATION));
    112112    }
    113113}
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/MinimapDialogTest.java

    r17279 r18690  
    33
    44import static java.util.concurrent.TimeUnit.MILLISECONDS;
    5 import static org.junit.Assert.assertArrayEquals;
    6 import static org.junit.Assert.assertEquals;
    7 import static org.junit.Assert.assertFalse;
    8 import static org.junit.Assert.assertTrue;
    9 import static org.junit.Assert.fail;
     5import static org.junit.jupiter.api.Assertions.assertArrayEquals;
     6import static org.junit.jupiter.api.Assertions.assertEquals;
     7import static org.junit.jupiter.api.Assertions.assertFalse;
     8import static org.junit.jupiter.api.Assertions.assertInstanceOf;
     9import static org.junit.jupiter.api.Assertions.assertTrue;
     10import static org.junit.jupiter.api.Assertions.fail;
    1011import static org.openstreetmap.josm.tools.I18n.tr;
    1112
     
    2728import javax.swing.JPopupMenu;
    2829
     30import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    2931import org.awaitility.Awaitility;
    3032import org.junit.Rule;
     
    5052import org.openstreetmap.josm.testutils.JOSMTestRules;
    5153
    52 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    53 
    5454/**
    5555 * Unit tests of {@link MinimapDialog} class.
     
    9595        boolean found = false;
    9696        for (Component c: menu.getComponents()) {
    97             if (JPopupMenu.Separator.class.isInstance(c)) {
     97            if (c instanceof JPopupMenu.Separator) {
    9898                break;
    9999            } else {
     
    102102                assertEquals(equalText, isSelected);
    103103                if (equalText) {
    104                     assertFalse("Second selected source found", found);
     104                    assertFalse(found, "Second selected source found");
    105105                    found = true;
    106106                }
    107107            }
    108108        }
    109         assertTrue("Selected source not found in menu", found);
     109        assertTrue(found, "Selected source not found in menu");
    110110    }
    111111
     
    115115                JPopupMenu menu = this.sourceButton.getPopupMenu();
    116116                for (Component c: menu.getComponents()) {
    117                     if (JPopupMenu.Separator.class.isInstance(c)) {
     117                    if (c instanceof JPopupMenu.Separator) {
    118118                        // sources should all come before any separators
    119119                        break;
     
    124124                    // else continue...
    125125                }
    126                 fail();
     126                fail("Expected JMenuItem with text " + label + " not found");
    127127            });
    128128        } catch (Throwable e) {
     
    196196    /**
    197197     * Tests to switch imagery source.
    198      * @throws Exception if any error occurs
    199198     */
    200199    @Test
    201     public void testSourceSwitching() throws Exception {
     200    public void testSourceSwitching() {
    202201        // relevant prefs starting out empty, should choose the first source and have shown download area enabled
    203202        // (not that there's a data layer for it to use)
     
    243242    /**
    244243     * Tests that the apparently-selected TileSource survives the tile sources being refreshed.
    245      * @throws Exception if any error occurs
    246244     */
    247245    @Test
    248     public void testRefreshSourcesRetainsSelection() throws Exception {
     246    public void testRefreshSourcesRetainsSelection() {
    249247        // relevant prefs starting out empty, should choose the first source and have shown download area enabled
    250248        // (not that there's a data layer for it to use)
     
    281279     * Tests that the currently selected source being removed from ImageryLayerInfo will remain present and
    282280     * selected in the source menu even after the tile sources have been refreshed.
    283      * @throws Exception if any error occurs
    284281     */
    285282    @Test
    286     public void testRemovedSourceStillSelected() throws Exception {
     283    public void testRemovedSourceStillSelected() {
    287284        // relevant prefs starting out empty, should choose the first source and have shown download area enabled
    288285        // (not that there's a data layer for it to use)
     
    314311    /**
    315312     * Tests the tile source list includes sources only present in the LayerManager
    316      * @throws Exception if any error occurs
    317313     */
    318314    @Test
    319     public void testTileSourcesFromCurrentLayers() throws Exception {
     315    public void testTileSourcesFromCurrentLayers() {
    320316        // relevant prefs starting out empty, should choose the first (ImageryLayerInfo) source and have shown download area enabled
    321317        // (not that there's a data layer for it to use)
     
    448444    /**
    449445     * Tests minimap obeys a saved "mapstyle" preference on startup.
    450      * @throws Exception if any error occurs
    451446     */
    452447    @Test
    453     public void testSourcePrefObeyed() throws Exception {
     448    public void testSourcePrefObeyed() {
    454449        Config.getPref().put("slippy_map_chooser.mapstyle", "Green Tiles");
    455450
     
    475470    /**
    476471     * Tests minimap handles an unrecognized "mapstyle" preference on startup
    477      * @throws Exception if any error occurs
    478472     */
    479473    @Test
    480     public void testSourcePrefInvalid() throws Exception {
     474    public void testSourcePrefInvalid() {
    481475        Config.getPref().put("slippy_map_chooser.mapstyle", "Hooloovoo Tiles");
    482476
     
    497491    /**
    498492     * test viewport marker rectangle matches the mapView's aspect ratio
    499      * @throws Exception if any error occurs
    500493     */
    501494    @Test
    502     public void testViewportAspectRatio() throws Exception {
     495    public void testViewportAspectRatio() {
    503496        // Add a test layer to the layer manager to get the MapFrame & MapView
    504497        MainApplication.getLayerManager().addLayer(new TestLayer());
     
    546539        // should equal the number on the right
    547540        assertTrue(
    548             "Viewport marker not horizontally centered",
    549             Math.abs(rowMatcher.group(1).length() - rowMatcher.group(3).length()) < 4
    550         );
     541                Math.abs(rowMatcher.group(1).length() - rowMatcher.group(3).length()) < 4,
     542                "Viewport marker not horizontally centered"
     543                );
    551544
    552545        Matcher colMatcher = ImagePatternMatching.columnMatch(
     
    561554        // should equal the number on the bottom
    562555        assertTrue(
    563             "Viewport marker not vertically centered",
    564             Math.abs(colMatcher.group(1).length() - colMatcher.group(3).length()) < 4
    565         );
     556                Math.abs(colMatcher.group(1).length() - colMatcher.group(3).length()) < 4,
     557                "Viewport marker not vertically centered"
     558                );
    566559
    567560        // (within a tolerance for numerical error) the viewport marker should be square
    568561        assertTrue(
    569             "Viewport marker not square",
    570             Math.abs(colMatcher.group(2).length() - rowMatcher.group(2).length()) < 4
    571         );
     562                Math.abs(colMatcher.group(2).length() - rowMatcher.group(2).length()) < 4,
     563                "Viewport marker not square"
     564                );
    572565
    573566        // now change the mapView size
     
    591584        );
    592585        assertTrue(
    593             "Viewport marker not horizontally centered",
    594             Math.abs(rowMatcher.group(1).length() - rowMatcher.group(3).length()) < 4
    595         );
     586                Math.abs(rowMatcher.group(1).length() - rowMatcher.group(3).length()) < 4,
     587                "Viewport marker not horizontally centered"
     588                );
    596589
    597590        colMatcher = ImagePatternMatching.columnMatch(
     
    603596        );
    604597        assertTrue(
    605             "Viewport marker not vertically centered",
    606             Math.abs(colMatcher.group(1).length() - colMatcher.group(3).length()) < 4
    607         );
     598                Math.abs(colMatcher.group(1).length() - colMatcher.group(3).length()) < 4,
     599                "Viewport marker not vertically centered"
     600                );
    608601
    609602        try {
     
    614607
    615608        assertTrue(
    616             "Viewport marker not 2:1 aspect ratio",
    617             Math.abs(colMatcher.group(2).length() - (rowMatcher.group(2).length()*2.0)) < 5
    618         );
     609                Math.abs(colMatcher.group(2).length() - (rowMatcher.group(2).length()*2.0)) < 5,
     610                "Viewport marker not 2:1 aspect ratio"
     611                );
    619612    }
    620613
     
    623616        boolean afterSeparator = false;
    624617        for (Component c: menu.getComponents()) {
    625             if (JPopupMenu.Separator.class.isInstance(c)) {
    626                 assertFalse("More than one separator before target item", afterSeparator);
     618            if (c instanceof JPopupMenu.Separator) {
     619                assertFalse(afterSeparator, "More than one separator before target item");
    627620                afterSeparator = true;
    628621            } else if (((JMenuItem) c).getText().equals(tr("Show downloaded area"))) {
    629                 assertTrue("Separator not found before target item", afterSeparator);
    630                 assertTrue("Target item doesn't appear to be a JCheckBoxMenuItem", JCheckBoxMenuItem.class.isInstance(c));
    631                 return (JCheckBoxMenuItem) c;
     622                assertTrue(afterSeparator, "Separator not found before target item");
     623                return assertInstanceOf(JCheckBoxMenuItem.class, c, "Target item doesn't appear to be a JCheckBoxMenuItem");
    632624            }
    633625        }
     
    638630    /**
    639631     * test downloaded area is shown shaded
    640      * @throws Exception if any error occurs
    641632     */
    642633    @Test
    643     public void testShowDownloadedArea() throws Exception {
     634    public void testShowDownloadedArea() {
    644635        Config.getPref().put("slippy_map_chooser.mapstyle", "Green Tiles");
    645636        Config.getPref().putBoolean("slippy_map_chooser.show_downloaded_area", false);
     
    797788    /**
    798789     * test display of downloaded area follows active layer switching
    799      * @throws Exception if any error occurs
    800790     */
    801791    @Test
    802     public void testShowDownloadedAreaLayerSwitching() throws Exception {
     792    public void testShowDownloadedAreaLayerSwitching() {
    803793        Config.getPref().put("slippy_map_chooser.mapstyle", "Green Tiles");
    804794        Config.getPref().putBoolean("slippy_map_chooser.show_downloaded_area", true);
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/layer/CycleLayerActionTest.java

    r17279 r18690  
    22package org.openstreetmap.josm.gui.dialogs.layer;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55import static org.openstreetmap.josm.tools.I18n.tr;
    66
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/layer/DuplicateActionTest.java

    r18037 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.assertNotNull;
    77import static org.junit.jupiter.api.Assertions.assertNull;
     
    3737                editLayer = MainApplication.getLayerManager().getEditLayer();
    3838                assertNotNull(editLayer);
    39                 assertFalse(layer.equals(editLayer));
     39                assertNotEquals(layer, editLayer);
    4040                assertEquals(layer.data.getNodes().size(), editLayer.data.getNodes().size());
    4141                assertEquals(layer.data.getWays().size(), editLayer.data.getWays().size());
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/sort/RelationSorterTest.java

    r17275 r18690  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.gui.dialogs.relation.sort;
     3
     4import static org.junit.jupiter.api.Assertions.assertArrayEquals;
     5import static org.junit.jupiter.api.Assertions.assertEquals;
    36
    47import java.io.IOException;
     
    811import java.util.List;
    912
    10 import org.junit.Assert;
    1113import org.junit.jupiter.api.BeforeEach;
    1214import org.junit.jupiter.api.Test;
     
    6870        final String[] expected = {"t1w4", "t1w3", "t1w2", "t1w1", "t1w7", "t1w6", "t1w5", "t1n1", "t1n2"};
    6971        // expect nodes to be sorted correctly
    70         Assert.assertEquals(expected[7], actual[7]);
    71         Assert.assertEquals(expected[8], actual[8]);
     72        assertEquals(expected[7], actual[7]);
     73        assertEquals(expected[8], actual[8]);
    7274    }
    7375
     
    7577    void testAssociatedStreet() {
    7678        String[] actual = getNames(sorter.sortMembers(getRelation("associatedStreet").getMembers()));
    77         Assert.assertArrayEquals(new String[] {"t2w1", "t2w2", "t2n1", "t2n2", "t2n3", "t2n4"}, actual);
     79        assertArrayEquals(new String[] {"t2w1", "t2w2", "t2n1", "t2n2", "t2n3", "t2n4"}, actual);
    7880    }
    7981
     
    8183    void testStreet() {
    8284        String[] actual = getNames(sorter.sortMembers(getRelation("street").getMembers()));
    83         Assert.assertArrayEquals(new String[]{"t2w1", "t2w2", "t2n1", "t2n2", "t2n3", "t2n4", "playground", "tree"}, actual);
     85        assertArrayEquals(new String[]{"t2w1", "t2w2", "t2n1", "t2n2", "t2n3", "t2n4", "playground", "tree"}, actual);
    8486    }
    8587
     
    9496        // Check the first way before sorting, otherwise the sorter
    9597        // might pick a different loop starting point than expected below
    96         Assert.assertEquals("t5w1", relation.getMembers().get(0).getMember().get("name"));
     98        assertEquals("t5w1", relation.getMembers().get(0).getMember().get("name"));
    9799
    98100        String[] actual = getNames(sorter.sortMembers(relation.getMembers()));
    99         Assert.assertArrayEquals(new String[]{
     101        assertArrayEquals(new String[]{
    100102            "t5w1", "t5w2a", "t5w3a", "t5w4a", "t5w2b", "t5w3b", "t5w4b",
    101103            "t5w5", "t5w6a", "t5w7a", "t5w8a", "t5w6b", "t5w7b", "t5w8b",
     
    110112        // Check the first way before sorting, otherwise the sorter
    111113        // might sort in reverse compared to what is expected below
    112         Assert.assertEquals("t5w1", relation.getMembers().get(0).getMember().get("name"));
     114        assertEquals("t5w1", relation.getMembers().get(0).getMember().get("name"));
    113115
    114116        String[] actual = getNames(sorter.sortMembers(relation.getMembers()));
    115         Assert.assertArrayEquals(new String[]{
     117        assertArrayEquals(new String[]{
    116118            "t5w1", "t5w2a", "t5w3a", "t5w4a", "t5w2b", "t5w3b", "t5w4b",
    117119            "t5w5", "t5w6a", "t5w7a", "t5w8a", "t5w6b", "t5w7b", "t5w8b",
     
    125127        Relation relation = getRelation("three-loops-ends-node");
    126128        String[] actual = getNames(sorter.sortMembers(relation.getMembers()));
    127         Assert.assertArrayEquals(new String[]{
     129        assertArrayEquals(new String[]{
    128130            "t5w4a", "t5w3a", "t5w2a", "t5w2b", "t5w3b", "t5w4b",
    129131            "t5w5", "t5w6a", "t5w7a", "t5w8a", "t5w6b", "t5w7b", "t5w8b",
     
    136138        Relation relation = getRelation("one-loop-ends-split");
    137139        String[] actual = getNames(sorter.sortMembers(relation.getMembers()));
    138         Assert.assertArrayEquals(new String[]{
     140        assertArrayEquals(new String[]{
    139141            "t5w3a", "t5w4a", "t5w3b", "t5w4b",
    140142            "t5w5", "t5w6a", "t5w7a", "t5w8a", "t5w6b", "t5w7b", "t5w8b",
     
    150152        // for now.
    151153        String[] actual = getNames(relation.getMembers());
    152         Assert.assertArrayEquals(new String[]{
     154        assertArrayEquals(new String[]{
    153155            "t5w7a", "t5w8a", "t5w7b", "t5w8b",
    154156            "t5w9a", "t5w10a", "t5w9b", "t5w10b",
     
    161163        // TODO: This is not yet sorted perfectly (might not be possible)
    162164        String[] actual = getNames(sorter.sortMembers(relation.getMembers()));
    163         Assert.assertArrayEquals(new String[]{
     165        assertArrayEquals(new String[]{
    164166            "t5w1", "t5w2a", "t5w3a", "t5w4a", "t5w2b", "t5w3b",
    165167            "t5w5", "t5w6a", "t5w7a", "t5w8a", "t5w9a", "t5w10a", "t5w11a", "t5w6b", "t5w7b",
     
    173175        // TODO: This is not always sorted properly, only when the right
    174176        // way is already at the top, so check that
    175         Assert.assertEquals("t6w1a", relation.getMembers().get(0).getMember().get("name"));
     177        assertEquals("t6w1a", relation.getMembers().get(0).getMember().get("name"));
    176178
    177179        String[] actual = getNames(sorter.sortMembers(relation.getMembers()));
    178         Assert.assertArrayEquals(new String[]{
     180        assertArrayEquals(new String[]{
    179181            "t6w1a", "t6w2a", "t6w3a",
    180182            "t6w1b", "t6w2b", "t6w3b",
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/sort/WayConnectionTypeCalculatorTest.java

    r17275 r18690  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.gui.dialogs.relation.sort;
     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.io.IOException;
     
    1216import java.util.List;
    1317
    14 import org.junit.Assert;
    1518import org.junit.jupiter.api.BeforeEach;
    1619import org.junit.jupiter.api.Test;
     
    102105    void testEmpty() {
    103106        String actual = getConnections(wayConnectionTypeCalculator.updateLinks(new ArrayList<>()));
    104         Assert.assertEquals("[]", actual);
     107        assertEquals("[]", actual);
    105108    }
    106109
     
    113116        Relation relation = getRelation("generic");
    114117        String actual = getConnections(wayConnectionTypeCalculator.updateLinks(relation.getMembers()));
    115         Assert.assertEquals("[NONE, NONE, FORWARD, FORWARD, NONE, NONE, NONE, I, I]", actual);
     118        assertEquals("[NONE, NONE, FORWARD, FORWARD, NONE, NONE, NONE, I, I]", actual);
    116119        actual = getConnections(wayConnectionTypeCalculator.updateLinks(sorter.sortMembers(relation.getMembers())));
    117         Assert.assertEquals("[FORWARD, FORWARD, FORWARD, FORWARD, BACKWARD, BACKWARD, NONE, I, I]", actual);
     120        assertEquals("[FORWARD, FORWARD, FORWARD, FORWARD, BACKWARD, BACKWARD, NONE, I, I]", actual);
    118121    }
    119122
     
    122125        Relation relation = getRelation("associatedStreet");
    123126        String actual = getConnections(wayConnectionTypeCalculator.updateLinks(relation.getMembers()));
    124         Assert.assertEquals("[NONE, I, I, I, NONE, I]", actual);
     127        assertEquals("[NONE, I, I, I, NONE, I]", actual);
    125128        actual = getConnections(wayConnectionTypeCalculator.updateLinks(sorter.sortMembers(relation.getMembers())));
    126         Assert.assertEquals("[FORWARD, FORWARD, I, I, I, I]", actual);
     129        assertEquals("[FORWARD, FORWARD, I, I, I, I]", actual);
    127130    }
    128131
     
    131134        Relation relation = getRelation("loop");
    132135        String actual = getConnections(wayConnectionTypeCalculator.updateLinks(relation.getMembers()));
    133         Assert.assertEquals("[FPH FORWARD, FP FORWARD, NONE, FPH FORWARD, NONE, FPH FORWARD, NONE]", actual);
     136        assertEquals("[FPH FORWARD, FP FORWARD, NONE, FPH FORWARD, NONE, FPH FORWARD, NONE]", actual);
    134137        //TODO Sorting doesn't work well in this case
    135138        actual = getConnections(wayConnectionTypeCalculator.updateLinks(sorter.sortMembers(relation.getMembers())));
    136         Assert.assertEquals("[BACKWARD, BACKWARD, BACKWARD, FP FORWARD, BP BACKWARD, BP BACKWARD, BPT BACKWARD]", actual);
     139        assertEquals("[BACKWARD, BACKWARD, BACKWARD, FP FORWARD, BP BACKWARD, BP BACKWARD, BPT BACKWARD]", actual);
    137140    }
    138141
     
    147150        // Check the first way before sorting, otherwise the sorter
    148151        // might pick a different loop starting point than expected below
    149         Assert.assertEquals("t5w1", relation.getMembers().get(0).getMember().get("name"));
     152        assertEquals("t5w1", relation.getMembers().get(0).getMember().get("name"));
    150153        String actual = getConnections(wayConnectionTypeCalculator.updateLinks(sorter.sortMembers(relation.getMembers())));
    151154        String expected = "[" +
     
    155158            "L FORWARD, L FORWARD" +
    156159        "]";
    157         Assert.assertEquals(expected, actual);
     160        assertEquals(expected, actual);
    158161    }
    159162
     
    163166        // Check the first way before sorting, otherwise the sorter
    164167        // might sort in reverse compared to what is expected below
    165         Assert.assertEquals("t5w1", relation.getMembers().get(0).getMember().get("name"));
     168        assertEquals("t5w1", relation.getMembers().get(0).getMember().get("name"));
    166169        String actual = getConnections(wayConnectionTypeCalculator.updateLinks(sorter.sortMembers(relation.getMembers())));
    167170        String expected = "[" +
     
    171174            "FORWARD" +
    172175        "]";
    173         Assert.assertEquals(expected, actual);
     176        assertEquals(expected, actual);
    174177    }
    175178
     
    183186            "FPH FORWARD, FP FORWARD, FP FORWARD, FP FORWARD, FP FORWARD, BPT BACKWARD" +
    184187        "]";
    185         Assert.assertEquals(expected, actual);
     188        assertEquals(expected, actual);
    186189    }
    187190
     
    195198            "FPH FORWARD, FP FORWARD, BP BACKWARD, BP BACKWARD" +
    196199        "]";
    197         Assert.assertEquals(expected, actual);
     200        assertEquals(expected, actual);
    198201    }
    199202
     
    208211            "FPH FORWARD, FP FORWARD, BP BACKWARD, BP BACKWARD" +
    209212        "]";
    210         Assert.assertEquals(expected, actual);
     213        assertEquals(expected, actual);
    211214    }
    212215
     
    221224            "BACKWARD, FPH FORWARD, FP FORWARD, FP FORWARD" +
    222225        "]";
    223         Assert.assertEquals(expected, actual);
     226        assertEquals(expected, actual);
    224227    }
    225228
     
    229232        // TODO: This is not always sorted properly, only when the right
    230233        // way is already at the top, so check that
    231         Assert.assertEquals("t6w1a", relation.getMembers().get(0).getMember().get("name"));
     234        assertEquals("t6w1a", relation.getMembers().get(0).getMember().get("name"));
    232235        String actual = getConnections(wayConnectionTypeCalculator.updateLinks(sorter.sortMembers(relation.getMembers())));
    233236        String expected = "[" +
    234237            "FP FORWARD, FP FORWARD, FP FORWARD, BP BACKWARD, BP BACKWARD, BP BACKWARD" +
    235238        "]";
    236         Assert.assertEquals(expected, actual);
     239        assertEquals(expected, actual);
    237240    }
    238241
     
    256259        List<WayConnectionType> returned = wayConnectionTypeCalculator.updateLinks(relation.getMembers());
    257260        for (int i = 0; i < 4; i++) {
    258             Assert.assertTrue(returned.get(i).onewayFollowsPrevious);
    259             Assert.assertTrue(returned.get(i).onewayFollowsNext);
    260         }
    261 
    262         Assert.assertTrue(returned.get(4).onewayFollowsPrevious);
    263         Assert.assertFalse(returned.get(4).onewayFollowsNext);
    264 
    265         Assert.assertFalse(returned.get(5).onewayFollowsPrevious);
    266         Assert.assertFalse(returned.get(5).onewayFollowsNext);
    267 
    268         Assert.assertFalse(returned.get(6).onewayFollowsPrevious);
    269         Assert.assertTrue(returned.get(6).onewayFollowsNext);
     261            assertTrue(returned.get(i).onewayFollowsPrevious);
     262            assertTrue(returned.get(i).onewayFollowsNext);
     263        }
     264
     265        assertTrue(returned.get(4).onewayFollowsPrevious);
     266        assertFalse(returned.get(4).onewayFollowsNext);
     267
     268        assertFalse(returned.get(5).onewayFollowsPrevious);
     269        assertFalse(returned.get(5).onewayFollowsNext);
     270
     271        assertFalse(returned.get(6).onewayFollowsPrevious);
     272        assertTrue(returned.get(6).onewayFollowsNext);
    270273
    271274        // Reverse the last oneway
     
    276279            returned = wayConnectionTypeCalculator.updateLinks(relation.getMembers());
    277280            for (int i = 0; i < 4; i++) {
    278                 Assert.assertTrue(returned.get(i).onewayFollowsPrevious);
    279                 Assert.assertTrue(returned.get(i).onewayFollowsNext);
     281                assertTrue(returned.get(i).onewayFollowsPrevious);
     282                assertTrue(returned.get(i).onewayFollowsNext);
    280283            }
    281284
    282             Assert.assertTrue(returned.get(4).onewayFollowsPrevious);
    283             Assert.assertFalse(returned.get(4).onewayFollowsNext);
    284 
    285             Assert.assertFalse(returned.get(5).onewayFollowsPrevious);
    286             Assert.assertTrue(returned.get(5).onewayFollowsNext);
    287 
    288             Assert.assertTrue(returned.get(6).onewayFollowsPrevious);
    289             Assert.assertTrue(returned.get(6).onewayFollowsNext);
     285            assertTrue(returned.get(4).onewayFollowsPrevious);
     286            assertFalse(returned.get(4).onewayFollowsNext);
     287
     288            assertFalse(returned.get(5).onewayFollowsPrevious);
     289            assertTrue(returned.get(5).onewayFollowsNext);
     290
     291            assertTrue(returned.get(6).onewayFollowsPrevious);
     292            assertTrue(returned.get(6).onewayFollowsNext);
    290293            reverseWay(way);
    291294        }
     
    298301            returned = wayConnectionTypeCalculator.updateLinks(relation.getMembers());
    299302            for (int i = 0; i < 7; i++) {
    300                 Assert.assertTrue(returned.get(i).onewayFollowsPrevious);
    301                 Assert.assertTrue(returned.get(i).onewayFollowsNext);
     303                assertTrue(returned.get(i).onewayFollowsPrevious);
     304                assertTrue(returned.get(i).onewayFollowsNext);
    302305            }
    303306        }
     
    309312        returned = wayConnectionTypeCalculator.updateLinks(relation.getMembers());
    310313        for (int i = 0; i < 7; i++) {
    311             Assert.assertTrue(returned.get(i).onewayFollowsPrevious);
    312             Assert.assertTrue(returned.get(i).onewayFollowsNext);
     314            assertTrue(returned.get(i).onewayFollowsPrevious);
     315            assertTrue(returned.get(i).onewayFollowsNext);
    313316        }
    314317    }
     
    326329        List<WayConnectionType> returned = wayConnectionTypeCalculator.updateLinks(relation.getMembers());
    327330        for (WayConnectionType type : returned) {
    328             Assert.assertTrue(type.onewayFollowsNext);
    329             Assert.assertTrue(type.onewayFollowsPrevious);
     331            assertTrue(type.onewayFollowsNext);
     332            assertTrue(type.onewayFollowsPrevious);
    330333        }
    331334
     
    334337        returned = wayConnectionTypeCalculator.updateLinks(relation.getMembers());
    335338        for (WayConnectionType type : returned) {
    336             Assert.assertTrue(type.onewayFollowsNext);
    337             Assert.assertTrue(type.onewayFollowsPrevious);
     339            assertTrue(type.onewayFollowsNext);
     340            assertTrue(type.onewayFollowsPrevious);
    338341        }
    339342
     
    346349        for (int i = 0; i < returned.size() - 1; i++) {
    347350            WayConnectionType type = returned.get(i);
    348             Assert.assertTrue(type.onewayFollowsNext);
    349             Assert.assertTrue(type.onewayFollowsPrevious);
    350         }
    351         Assert.assertTrue(returned.get(6).onewayFollowsNext);
    352         Assert.assertFalse(returned.get(6).onewayFollowsPrevious);
     351            assertTrue(type.onewayFollowsNext);
     352            assertTrue(type.onewayFollowsPrevious);
     353        }
     354        assertTrue(returned.get(6).onewayFollowsNext);
     355        assertFalse(returned.get(6).onewayFollowsPrevious);
    353356    }
    354357}
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/validator/ValidatorTreePanelTest.java

    r18037 r18690  
    22package org.openstreetmap.josm.gui.dialogs.validator;
    33
     4import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
    45import static org.junit.jupiter.api.Assertions.assertEquals;
    56import static org.junit.jupiter.api.Assertions.assertNotNull;
     
    3132    @Test
    3233    void testValidatorTreePanel() {
    33         assertNotNull(new ValidatorTreePanel());
     34        assertDoesNotThrow(() -> new ValidatorTreePanel());
    3435
    3536        ValidatorTreePanel vtp = new ValidatorTreePanel(new ArrayList<>(Arrays.asList(
     
    5960        vtp.setVisible(false);
    6061        Node n = new Node(10);
    61         vtp.setErrors(Arrays.asList(TestError.builder(null, Severity.ERROR, 0)
     62        vtp.setErrors(Collections.singletonList(TestError.builder(null, Severity.ERROR, 0)
    6263                .message("")
    6364                .primitives(n)
    6465                .build()));
    6566        assertEquals(1, vtp.getErrors().size());
    66         vtp.selectRelatedErrors(Collections.<OsmPrimitive>singleton(n));
     67        vtp.selectRelatedErrors(Collections.singleton(n));
    6768        vtp.expandAll();
    6869        assertNotNull(vtp.getRoot());
    6970        vtp.resetErrors();
    70         Set<? extends OsmPrimitive> filter = new HashSet<>(Arrays.asList(n));
     71        Set<? extends OsmPrimitive> filter = new HashSet<>(Collections.singletonList(n));
    7172        vtp.setFilter(filter);
    7273        assertEquals(filter, vtp.getFilter());
    73         vtp.setFilter(new HashSet<OsmPrimitive>());
     74        vtp.setFilter(new HashSet<>());
    7475        assertNull(vtp.getFilter());
    7576        vtp.setFilter(null);
  • trunk/test/unit/org/openstreetmap/josm/gui/history/HistoryLoadTaskTest.java

    r17275 r18690  
    5353
    5454    /**
    55      * Unit test of {@link HistoryLoadTask#loadHistory}
     55     * Unit test of {@link HistoryLoadTask#loadHistory(OsmServerHistoryReader, ProgressMonitor)}
    5656     * @throws OsmTransferException if an error occurs
    5757     */
  • trunk/test/unit/org/openstreetmap/josm/gui/io/AsynchronousUploadPrimitivesTaskTest.java

    r17275 r18690  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.gui.io;
     3
     4import static org.junit.jupiter.api.Assertions.assertFalse;
     5import static org.junit.jupiter.api.Assertions.assertNotNull;
    36
    47import java.util.Collections;
     
    710import javax.swing.JOptionPane;
    811
    9 import org.junit.Assert;
    1012import org.junit.jupiter.api.AfterEach;
    1113import org.junit.jupiter.api.BeforeEach;
     
    9496        Optional<AsynchronousUploadPrimitivesTask> task = AsynchronousUploadPrimitivesTask.
    9597                createAsynchronousUploadTask(strategy, layer, toUpload, changeset);
    96         Assert.assertNotNull(uploadPrimitivesTask);
    97         Assert.assertFalse(task.isPresent());
     98        assertNotNull(uploadPrimitivesTask);
     99        assertFalse(task.isPresent());
    98100    }
    99101}
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/GpxLayerTest.java

    r18008 r18690  
    55import static org.junit.jupiter.api.Assertions.assertEquals;
    66import static org.junit.jupiter.api.Assertions.assertFalse;
     7import static org.junit.jupiter.api.Assertions.assertInstanceOf;
    78import static org.junit.jupiter.api.Assertions.assertNull;
    89import static org.junit.jupiter.api.Assertions.assertThrows;
     
    8889    /**
    8990     * Unit test of {@link GpxLayer#GpxLayer}.
    90      * @throws Exception if any error occurs
    91      */
    92     @Test
    93     void testGpxLayer() throws Exception {
     91     */
     92    @Test
     93    void testGpxLayer() {
    9494        GpxLayer layer = new GpxLayer(new GpxData(), "foo", false);
    9595        GpxTrack trk = new GpxTrack(new ArrayList<IGpxTrackSegment>(), new HashMap<>());
     
    211211    void testGetTimespanForTrack() throws Exception {
    212212        assertEquals("", GpxLayer.getTimespanForTrack(
    213                 new GpxTrack(new ArrayList<Collection<WayPoint>>(), new HashMap<String, Object>())));
     213                new GpxTrack(new ArrayList<Collection<WayPoint>>(), new HashMap<>())));
    214214
    215215        assertEquals("2016-01-03 11:59:58 \u2013 12:00:00 (2.0 s)", GpxLayer.getTimespanForTrack(getMinimalGpxData().tracks.iterator().next()));
     
    238238    @Test
    239239    void testMergeFromIAE() {
    240         assertThrows(IllegalArgumentException.class, () -> new GpxLayer(new GpxData()).mergeFrom(new OsmDataLayer(new DataSet(), "", null)));
     240        final GpxLayer gpxLayer = new GpxLayer(new GpxData());
     241        final OsmDataLayer osmDataLayer = new OsmDataLayer(new DataSet(), "testMergeFromIAE", null);
     242        assertThrows(IllegalArgumentException.class, () -> gpxLayer.mergeFrom(osmDataLayer));
    241243    }
    242244
     
    297299        assertNull(layer.getAssociatedFile());
    298300        Object infoComponent = layer.getInfoComponent();
    299         assertTrue(infoComponent instanceof JScrollPane);
    300         Component view = ((JScrollPane) infoComponent).getViewport().getView();
    301         assertTrue(view instanceof HtmlPanel);
    302         String text = ((HtmlPanel) view).getEditorPane().getText().trim();
     301        Component view = assertInstanceOf(JScrollPane.class, infoComponent).getViewport().getView();
     302        String text = assertInstanceOf(HtmlPanel.class, view).getEditorPane().getText().trim();
    303303        assertTrue(text.startsWith("<html>"), text);
    304304        assertTrue(text.endsWith("</html>"), text);
    305305        assertEquals("<html><br></html>", layer.getToolTipText());
    306         assertDoesNotThrow(() -> layer.jumpToNextMarker());
    307         assertDoesNotThrow(() -> layer.jumpToPreviousMarker());
     306        assertDoesNotThrow(layer::jumpToNextMarker);
     307        assertDoesNotThrow(layer::jumpToPreviousMarker);
    308308        assertDoesNotThrow(() -> layer.visitBoundingBox(new BoundingXYVisitor()));
    309309        assertDoesNotThrow(() -> layer.filterTracksByDate(null, null, false));
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/gpx/ConvertToDataLayerActionTest.java

    r17275 r18690  
    99import java.nio.file.Paths;
    1010import java.util.Arrays;
     11import java.util.Collections;
    1112import java.util.Comparator;
    1213import java.util.List;
     
    7374
    7475        Config.getPref().put("gpx.convert-tags", "list");
    75         Config.getPref().putList("gpx.convert-tags.list.yes", Arrays.asList("ele"));
    76         Config.getPref().putList("gpx.convert-tags.list.no", Arrays.asList("time"));
     76        Config.getPref().putList("gpx.convert-tags.list.yes", Collections.singletonList("ele"));
     77        Config.getPref().putList("gpx.convert-tags.list.no", Collections.singletonList("time"));
    7778        testFromTrack("tracks.gpx", "tracks-ele.osm");
    7879
    79         Config.getPref().putList("gpx.convert-tags.list.yes", Arrays.asList("time"));
    80         Config.getPref().putList("gpx.convert-tags.list.no", Arrays.asList("ele"));
     80        Config.getPref().putList("gpx.convert-tags.list.yes", Collections.singletonList("time"));
     81        Config.getPref().putList("gpx.convert-tags.list.no", Collections.singletonList("ele"));
    8182        testFromTrack("tracks.gpx", "tracks-time.osm");
    8283
     
    141142
    142143        List<String> ways = osm.getWays().stream()
    143                 .map(w -> Integer.toString(w.getNodes().size()) + ":" + w.getKeys().entrySet().stream()
    144                         .sorted(Comparator.comparing(Map.Entry::getKey)).collect(Collectors.toList()).toString())
     144                .map(w -> w.getNodes().size() + ":" + w.getKeys().entrySet().stream()
     145                        .sorted(Map.Entry.comparingByKey()).collect(Collectors.toList()))
    145146                .sorted()
    146147                .collect(Collectors.toList());
    147148
    148149        List<String> waysExpected = osmExpected.getWays().stream()
    149                 .map(w -> Integer.toString(w.getNodes().size()) + ":" + w.getKeys().entrySet().stream()
    150                         .sorted(Comparator.comparing(Map.Entry::getKey)).collect(Collectors.toList()).toString())
     150                .map(w -> w.getNodes().size() + ":" + w.getKeys().entrySet().stream()
     151                        .sorted(Map.Entry.comparingByKey()).collect(Collectors.toList()))
    151152                .sorted()
    152153                .collect(Collectors.toList());
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/gpx/DownloadWmsAlongTrackActionTest.java

    r16159 r18690  
    33
    44import static java.util.concurrent.TimeUnit.MILLISECONDS;
    5 import static org.junit.Assert.assertEquals;
    6 import static org.junit.Assert.assertNotNull;
    7 import static org.junit.Assert.assertNull;
    8 import static org.junit.Assert.assertTrue;
     5import static org.junit.jupiter.api.Assertions.assertEquals;
     6import static org.junit.jupiter.api.Assertions.assertNotNull;
     7import static org.junit.jupiter.api.Assertions.assertNull;
     8import static org.junit.jupiter.api.Assertions.assertTrue;
    99
    1010import java.util.Collections;
  • trunk/test/unit/org/openstreetmap/josm/gui/mappaint/AllMappaintTests.java

    r17275 r18690  
    22package org.openstreetmap.josm.gui.mappaint;
    33
    4 import org.junit.runner.RunWith;
    5 import org.junit.runners.Suite;
     4import org.junit.platform.suite.api.SelectClasses;
     5import org.junit.platform.suite.api.Suite;
    66import org.openstreetmap.josm.gui.mappaint.mapcss.AllMapCSSTests;
    77
     
    99 * All mappaint tests.
    1010 */
    11 @RunWith(Suite.class)
    12 @Suite.SuiteClasses({
     11@Suite
     12@SelectClasses({
    1313    LabelCompositionStrategyTest.class,
    1414    MapCSSWithExtendedTextDirectivesTest.class,
  • trunk/test/unit/org/openstreetmap/josm/gui/mappaint/MapCSSWithExtendedTextDirectivesTest.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.assertNotNull;
    67import static org.junit.jupiter.api.Assertions.assertNull;
    7 import static org.junit.jupiter.api.Assertions.assertTrue;
    88
    99import java.awt.Color;
     
    4646        TextLabel te = TextLabel.create(env, Color.WHITE, false /* no default annotate */);
    4747        assertNotNull(te.labelCompositionStrategy);
    48         assertTrue(te.labelCompositionStrategy instanceof DeriveLabelFromNameTagsCompositionStrategy);
     48        assertInstanceOf(DeriveLabelFromNameTagsCompositionStrategy.class, te.labelCompositionStrategy);
    4949    }
    5050
     
    6363        TextLabel te = TextLabel.create(env, Color.WHITE, false /* no default annotate */);
    6464        assertNotNull(te.labelCompositionStrategy);
    65         assertTrue(te.labelCompositionStrategy instanceof TagLookupCompositionStrategy);
     65        assertInstanceOf(TagLookupCompositionStrategy.class, te.labelCompositionStrategy);
    6666        assertEquals("my_name", ((TagLookupCompositionStrategy) te.labelCompositionStrategy).getDefaultLabelTag());
    6767    }
  • trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/AllMapCSSTests.java

    r14068 r18690  
    22package org.openstreetmap.josm.gui.mappaint.mapcss;
    33
    4 import org.junit.runner.RunWith;
    5 import org.junit.runners.Suite;
     4import org.junit.platform.suite.api.SelectClasses;
     5import org.junit.platform.suite.api.Suite;
    66
    77/**
    88 * All MapCSS tests.
    99 */
    10 @RunWith(Suite.class)
    11 @Suite.SuiteClasses({
     10@Suite
     11@SelectClasses({
    1212    KeyValueConditionTest.class,
    1313    ParsingLinkSelectorTest.class,
  • trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/ConditionTest.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.assertInstanceOf;
    67import static org.junit.jupiter.api.Assertions.assertTrue;
    78
     
    5455        assertFalse(op.applies(genEnv(node4)));
    5556
    56         assertTrue(op instanceof SimpleKeyValueCondition);
     57        TagCondition tc = assertInstanceOf(SimpleKeyValueCondition.class, op);
    5758        assertEquals("[k1=v1]", op.toString());
    58         assertEquals("k1", ((TagCondition) op).asTag(null).getKey());
    59         assertEquals("v1", ((TagCondition) op).asTag(null).getValue());
     59        assertEquals("k1", tc.asTag(null).getKey());
     60        assertEquals("v1", tc.asTag(null).getValue());
    6061    }
    6162
  • trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParserTest.java

    r17920 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.assertNull;
     
    1617import java.util.regex.Pattern;
    1718
    18 import org.junit.Assert;
    1919import org.junit.jupiter.api.Test;
    2020import org.junit.jupiter.api.extension.RegisterExtension;
     
    8080    void testClassCondition() throws Exception {
    8181        List<Condition> conditions = getParser("way[name=X].highway:closed").selector().getConditions();
    82         assertTrue(conditions.get(0) instanceof SimpleKeyValueCondition);
     82        assertInstanceOf(SimpleKeyValueCondition.class, conditions.get(0));
    8383        assertTrue(conditions.get(0).applies(getEnvironment("name", "X")));
    84         assertTrue(conditions.get(1) instanceof ClassCondition);
    85         assertTrue(conditions.get(2) instanceof PseudoClassCondition);
     84        assertInstanceOf(ClassCondition.class, conditions.get(1));
     85        assertInstanceOf(PseudoClassCondition.class, conditions.get(2));
    8686        assertFalse(conditions.get(2).applies(getEnvironment("name", "X")));
    8787    }
     
    106106
    107107    @Test
    108     void testClassMatching() throws Exception {
     108    void testClassMatching() {
    109109        MapCSSStyleSource css = new MapCSSStyleSource(
    110110                "way[highway=footway] { set .path; color: #FF6644; width: 2; }\n" +
     
    147147    void testEqualCondition() throws Exception {
    148148        Condition condition = getParser("[surface=paved]").condition(PRIMITIVE);
    149         assertTrue(condition instanceof SimpleKeyValueCondition);
    150         assertEquals("surface", ((SimpleKeyValueCondition) condition).k);
    151         assertEquals("paved", ((SimpleKeyValueCondition) condition).v);
     149        SimpleKeyValueCondition simpleKeyValueCondition = assertInstanceOf(SimpleKeyValueCondition.class, condition);
     150        assertEquals("surface", simpleKeyValueCondition.k);
     151        assertEquals("paved", simpleKeyValueCondition.v);
    152152        assertTrue(condition.applies(getEnvironment("surface", "paved")));
    153153        assertFalse(condition.applies(getEnvironment("surface", "unpaved")));
     
    315315    private void tagRegex(Way way, String parserString, Boolean[] expected) throws Exception {
    316316        Selector selector = getParser(parserString).selector();
    317         Assert.assertEquals(expected[0], selector.matches(new Environment(way)));
     317        assertEquals(expected[0], selector.matches(new Environment(way)));
    318318        way.put("old_ref", null);
    319         Assert.assertEquals(expected[1], selector.matches(new Environment(way)));
     319        assertEquals(expected[1], selector.matches(new Environment(way)));
    320320        way.put("no_match_tag", "false");
    321         Assert.assertEquals(expected[2], selector.matches(new Environment(way)));
     321        assertEquals(expected[2], selector.matches(new Environment(way)));
    322322        way.put("old_ref", "A22");
    323         Assert.assertEquals(expected[3], selector.matches(new Environment(way)));
     323        assertEquals(expected[3], selector.matches(new Environment(way)));
    324324        way.put("old_ref", null);
    325325        way.put("OLD_REF", "A23");
    326         Assert.assertEquals(expected[4], selector.matches(new Environment(way)));
     326        assertEquals(expected[4], selector.matches(new Environment(way)));
    327327    }
    328328
     
    368368
    369369    @Test
    370     void testTicket8568() throws Exception {
     370    void testTicket8568() {
    371371        MapCSSStyleSource sheet = new MapCSSStyleSource(
    372372                "way { width: 5; }\n" +
     
    385385
    386386    @Test
    387     void testTicket8071() throws Exception {
     387    void testTicket8071() {
    388388        MapCSSStyleSource sheet = new MapCSSStyleSource(
    389389                "*[rcn_ref], *[name] {text: concat(tag(rcn_ref), \" \", tag(name)); }");
     
    421421
    422422    @Test
    423     void testColorParsing() throws Exception {
     423    void testColorParsing() {
    424424        assertEquals(new Color(0x12, 0x34, 0x56, 0x78), ColorHelper.html2color("#12345678"));
    425425    }
     
    459459
    460460    @Test
    461     void testParentTags() throws Exception {
     461    void testParentTags() {
    462462        DataSet ds = new DataSet();
    463463        Node n = new Node(new LatLon(1, 2));
     
    486486
    487487    @Test
    488     void testSort() throws Exception {
    489         assertEquals(Arrays.asList(new String[] {"alpha", "beta"}), Functions.sort(null, "beta", "alpha"));
     488    void testSort() {
     489        assertEquals(Arrays.asList("alpha", "beta"), Functions.sort(null, "beta", "alpha"));
    490490        Way way1 = TestUtils.newWay("highway=residential name=Alpha alt_name=Beta ref=\"A9;A8\"", new Node(new LatLon(0.001, 0.001)),
    491491                new Node(new LatLon(0.002, 0.002)));
     
    508508
    509509    @Test
    510     void testUniqueValues() throws Exception {
    511         assertEquals(Arrays.asList(new String[] {"alpha", "beta"}),
     510    void testUniqueValues() {
     511        assertEquals(Arrays.asList("alpha", "beta"),
    512512                Functions.uniq(null, "alpha", "alpha", "alpha", "beta"));
    513         assertEquals(Arrays.asList(new String[] {"one", "two", "three"}),
    514                 Functions.uniq_list(Arrays.asList(new String[] {"one", "one", "two", "two", "two", "three"})));
    515     }
    516 
    517     @Test
    518     void testCountRoles() throws Exception {
     513        assertEquals(Arrays.asList("one", "two", "three"),
     514                Functions.uniq_list(Arrays.asList("one", "one", "two", "two", "two", "three")));
     515    }
     516
     517    @Test
     518    void testCountRoles() {
    519519        DataSet ds = new DataSet();
    520520        Way way1 = TestUtils.newWay("highway=residential name=1",
     
    596596
    597597    @Test
    598     void testInvalidBaseSelector() throws Exception {
     598    void testInvalidBaseSelector() {
    599599        MapCSSStyleSource css = new MapCSSStyleSource("invalid_base[key=value] {}");
    600600        css.loadStyleSource();
     
    624624        assertEquals(24.0, mc.getCascade(null).get("div"));
    625625        assertEquals(-13.0, mc.getCascade(null).get("neg"));
    626         assertEquals(true, mc.getCascade(null).get("not"));
     626        assertEquals(Boolean.TRUE, mc.getCascade(null).get("not"));
    627627        assertNull(mc.getCascade(null).get("null0"));
    628628        assertNull(mc.getCascade(null).get("null1"));
     
    631631
    632632    @Test
    633     void testMinMaxFunctions() throws Exception {
     633    void testMinMaxFunctions() {
    634634        MapCSSStyleSource sheet = new MapCSSStyleSource("* {" +
    635635                "min_value: min(tag(x), tag(y), tag(z)); " +
     
    700700    @Test
    701701    void testZoomIAE() {
    702         assertThrows(IllegalArgumentException.class, () -> getParser("|z16-15").zoom());
     702        final MapCSSParser parser = getParser("|z16-15");
     703        assertThrows(IllegalArgumentException.class, parser::zoom);
    703704    }
    704705
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/AbstractExtendedSourceEntryTestCase.java

    r17531 r18690  
    2323    protected static final List<String> errorsToIgnore = new ArrayList<>();
    2424
    25     protected static List<Object[]> getTestParameters(Collection<ExtendedSourceEntry> entries) throws Exception {
     25    protected static List<Object[]> getTestParameters(Collection<ExtendedSourceEntry> entries) {
    2626        return entries.stream().map(x -> new Object[] {x.getDisplayName(), cleanUrl(x.url), x}).collect(Collectors.toList());
    2727    }
     
    4545    protected final void handleException(ExtendedSourceEntry source, Throwable e, Set<String> errors, List<String> ignoredErrors) {
    4646        e.printStackTrace();
    47         String s = source.url + " => " + e.toString();
     47        String s = source.url + " => " + e;
    4848        if (isIgnoredSubstring(source, s)) {
    4949            ignoredErrors.add(s);
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/ToolbarPreferencesTest.java

    r17275 r18690  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.gui.preferences;
     3
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    35
    46import java.awt.event.ActionEvent;
     
    1113import javax.swing.Action;
    1214
    13 import org.junit.Assert;
    1415import org.junit.jupiter.api.Test;
    1516import org.openstreetmap.josm.actions.ActionParameter;
     
    5455            expected.put((String) params[i], params[i+1]);
    5556        }
    56         Assert.assertEquals(expected, a.getParameters());
     57        assertEquals(expected, a.getParameters());
    5758    }
    5859
     
    7374        checkAction(parser.loadAction("action(uknownParam=aa)"));
    7475
    75         Assert.assertEquals("action(param1=value1,param2=value2)",
    76                 parser.saveAction(parser.loadAction("action(param1=value1,param2=value2)")));
    77         Assert.assertEquals("action(param1=value1,param2=)",
    78                 parser.saveAction(parser.loadAction("action(param1=value1)")));
    79         Assert.assertEquals("action(param1=value1,param2=2\\(\\=\\,\\\\)",
    80                 parser.saveAction(parser.loadAction("action(param1=value1,param2=2\\(\\=\\,\\\\)")));
     76        assertEquals("action(param1=value1,param2=value2)", parser.saveAction(parser.loadAction("action(param1=value1,param2=value2)")));
     77        assertEquals("action(param1=value1,param2=)", parser.saveAction(parser.loadAction("action(param1=value1)")));
     78        assertEquals(
     79                "action(param1=value1,param2=2\\(\\=\\,\\\\)",
     80                parser.saveAction(parser.loadAction("action(param1=value1,param2=2\\(\\=\\,\\\\)"))
     81        );
    8182    }
    8283}
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreferenceTestIT.java

    r18211 r18690  
    146146
    147147    private static boolean isIgnoredSubstring(String substring) {
    148         return errorsToIgnore.parallelStream().anyMatch(x -> substring.contains(x));
     148        return errorsToIgnore.parallelStream().anyMatch(substring::contains);
    149149    }
    150150
     
    342342            }
    343343        } catch (IOException | RuntimeException | WMSGetCapabilitiesException e) {
    344             addError(info, info.getUrl() + ERROR_SEP + e.toString());
     344            addError(info, info.getUrl() + ERROR_SEP + e);
    345345        }
    346346
     
    394394                return new WMTSTileSource(info, proj);
    395395            } catch (IOException | WMTSGetCapabilitiesException e) {
    396                 addError(info, info.getUrl() + ERROR_SEP + e.toString());
     396                addError(info, info.getUrl() + ERROR_SEP + e);
    397397                return null;
    398398            }
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferenceHighLevelTest.java

    r17195 r18690  
    44import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
    55import static java.util.concurrent.TimeUnit.MILLISECONDS;
    6 import static org.junit.Assert.assertEquals;
    7 import static org.junit.Assert.assertFalse;
    8 import static org.junit.Assert.assertTrue;
     6import static org.junit.jupiter.api.Assertions.assertEquals;
     7import static org.junit.jupiter.api.Assertions.assertFalse;
     8import static org.junit.jupiter.api.Assertions.assertTrue;
    99
    1010import java.awt.Component;
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetReaderTest.java

    r17369 r18690  
    55import static org.hamcrest.MatcherAssert.assertThat;
    66import static org.junit.jupiter.api.Assertions.assertEquals;
     7import static org.junit.jupiter.api.Assertions.assertInstanceOf;
    78import static org.junit.jupiter.api.Assertions.assertTrue;
    89import static org.junit.jupiter.api.Assertions.fail;
     
    1314import java.util.stream.Collectors;
    1415
    15 import org.junit.Assert;
    1616import org.junit.jupiter.api.Test;
    1717import org.junit.jupiter.api.extension.RegisterExtension;
     
    4545        String presetfile = TestUtils.getRegressionDataFile(8954, "preset.xml");
    4646        final Collection<TaggingPreset> presets = TaggingPresetReader.readAll(presetfile, false);
    47         Assert.assertEquals("Number of preset items", 1, presets.size());
     47        assertEquals(1, presets.size(), "Number of preset items");
    4848        final TaggingPreset preset = presets.iterator().next();
    49         Assert.assertEquals("Number of entries", 1, preset.data.size());
     49        assertEquals(1, preset.data.size(), "Number of entries");
    5050        final TaggingPresetItem item = preset.data.get(0);
    51         Assert.assertTrue("Entry is not checkbox", item instanceof Check);
     51        assertInstanceOf(Check.class, item, "Entry is not checkbox");
    5252    }
    5353
     
    9393        String presetfile = "resource://data/defaultpresets.xml";
    9494        final Collection<TaggingPreset> presets = TaggingPresetReader.readAll(presetfile, true);
    95         Assert.assertTrue("Default presets are empty", presets.size() > 0);
     95        assertTrue(presets.size() > 0, "Default presets are empty");
    9696    }
    9797}
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetsTest.java

    r18683 r18690  
    33
    44import static org.junit.jupiter.api.Assertions.assertAll;
     5import static org.junit.jupiter.api.Assertions.assertInstanceOf;
    56import static org.junit.jupiter.api.Assertions.assertSame;
    6 import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    88import java.util.Collection;
     
    6262        assertAll(() -> assertSame(menu.presetSearchAction, presetsMenu.getItem(0).getAction()),
    6363                () -> assertSame(menu.presetSearchPrimitiveAction, presetsMenu.getItem(1).getAction()),
    64                 () -> assertTrue(presetsMenu.getItem(2).getAction() instanceof PreferencesAction),
    65                 () -> assertTrue(presetsMenu.getMenuComponent(3) instanceof JSeparator));
     64                () -> assertInstanceOf(PreferencesAction.class, presetsMenu.getItem(2).getAction()),
     65                () -> assertInstanceOf(JSeparator.class, presetsMenu.getMenuComponent(3)));
    6666    }
    6767
  • trunk/test/unit/org/openstreetmap/josm/gui/widgets/HistoryComboBoxTest.java

    r18131 r18690  
    2121class HistoryComboBoxTest {
    2222    static Stream<Arguments> testNonRegression21203() {
    23         return Stream.of(Arguments.of("Hello world"), Arguments.of(new AutoCompletionItem("Hello world2")), Arguments.of(new Double(42)));
     23        return Stream.of(Arguments.of("Hello world"), Arguments.of(new AutoCompletionItem("Hello world2")), Arguments.of(42.0));
    2424    }
    2525
     
    5959        historyComboBox.addCurrentItemToHistory();
    6060
    61         // add a new item
     61        // Add a new item
    6262        historyComboBox.getEditor().setItem(new AutoCompletionItem("testNonRegression21215_2"));
    6363        historyComboBox.addCurrentItemToHistory();
  • trunk/test/unit/org/openstreetmap/josm/io/CertificateAmendmentTestIT.java

    r18228 r18690  
    22package org.openstreetmap.josm.io;
    33
     4import static org.junit.jupiter.api.Assertions.fail;
    45import static org.junit.jupiter.api.Assumptions.assumeFalse;
    56
     
    1213import javax.net.ssl.SSLHandshakeException;
    1314
    14 import org.junit.Assert;
    1515import org.junit.ClassRule;
    1616import org.junit.jupiter.api.BeforeAll;
     
    111111        assumeFalse(errorsToIgnore.contains(error));
    112112        if (!shouldWork) {
    113             Assert.fail(error);
     113            fail(error);
    114114        }
    115115    }
  • trunk/test/unit/org/openstreetmap/josm/io/GeoJSONReaderTest.java

    r18464 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.assertThrows;
     
    221222            assertEquals(1, primitives.size());
    222223            OsmPrimitive primitive = primitives.get(0);
    223             assertTrue(primitive instanceof Node);
    224             Node n = (Node) primitive;
     224            Node n = assertInstanceOf(Node.class, primitive);
    225225            assertNull(n.get("addr:building"));
    226226            assertEquals("06883", n.get("addr:postcode"));
  • trunk/test/unit/org/openstreetmap/josm/io/OsmChangesetContentParserTest.java

    r18037 r18690  
    44import static org.junit.jupiter.api.Assertions.assertEquals;
    55import static org.junit.jupiter.api.Assertions.assertNotNull;
     6import static org.junit.jupiter.api.Assertions.assertThrows;
    67import static org.junit.jupiter.api.Assertions.assertTrue;
    7 import static org.junit.jupiter.api.Assertions.fail;
    88
    99import java.io.ByteArrayInputStream;
     
    1212import java.util.Arrays;
    1313
     14import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     15import org.junit.jupiter.api.Test;
    1416import org.openstreetmap.josm.data.osm.ChangesetDataSet;
    1517import org.openstreetmap.josm.data.osm.ChangesetDataSet.ChangesetModificationType;
     
    2123import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
    2224import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
    23 import org.openstreetmap.josm.tools.Logging;
    2425import org.openstreetmap.josm.tools.XmlParsingException;
    25 
    26 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    27 import org.junit.jupiter.api.Test;
    2826
    2927/**
     
    3230@BasicPreferences
    3331class OsmChangesetContentParserTest {
    34     private static void shouldFail(Runnable r) {
    35         try {
    36             r.run();
    37             fail("should throw exception");
    38         } catch (IllegalArgumentException e) {
    39             Logging.trace(e);
    40         }
    41     }
    42 
    4332    /**
    4433     * Test various constructor invocations
     
    5140        new OsmChangesetContentParser(new ByteArrayInputStream("".getBytes(StandardCharsets.UTF_8)));
    5241
    53         shouldFail(() -> {
    54             new OsmChangesetContentParser((String) null);
    55         });
    56 
    57         shouldFail(() -> {
    58             new OsmChangesetContentParser((InputStream) null);
    59         });
     42        assertThrows(IllegalArgumentException.class, () -> new OsmChangesetContentParser((String) null));
     43
     44        assertThrows(IllegalArgumentException.class, () -> new OsmChangesetContentParser((InputStream) null));
    6045    }
    6146
  • trunk/test/unit/org/openstreetmap/josm/io/OsmWriterTest.java

    r18037 r18690  
    1414import java.util.ArrayList;
    1515import java.util.Arrays;
    16 import java.util.Collections;
    1716import java.util.List;
    1817
     
    4847        }
    4948
    50         Collections.sort(ids, OsmWriter.byIdComparator);
     49        ids.sort(OsmWriter.byIdComparator);
    5150
    5251        final long[] longIds = ids.stream().mapToLong(NodeData::getUniqueId).toArray();
  • trunk/test/unit/org/openstreetmap/josm/io/UrlPatternsTest.java

    r17275 r18690  
    3737    void testUrlPatterns() {
    3838        assertTrue(patterns.stream().flatMap(c -> Arrays.stream(c.getEnumConstants())).map(t -> ((UrlPattern) t).pattern())
    39                 .map(Pattern::compile).count() > 0);
     39                .map(Pattern::compile).findAny().isPresent());
    4040    }
    4141}
  • trunk/test/unit/org/openstreetmap/josm/io/nmea/NmeaReaderTest.java

    r17715 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
     
    7071        assertEquals("3d", wayPoints.get(0).get(GpxConstants.PT_FIX));
    7172        assertEquals("0.7", wayPoints.get(0).get(GpxConstants.PT_HDOP).toString().trim());
    72         assertEquals(null, wayPoints.get(0).get(GpxConstants.PT_VDOP));
    73         assertEquals(null, wayPoints.get(0).get(GpxConstants.PT_PDOP));
     73        assertNull(wayPoints.get(0).get(GpxConstants.PT_VDOP));
     74        assertNull(wayPoints.get(0).get(GpxConstants.PT_PDOP));
    7475    }
    7576
  • trunk/test/unit/org/openstreetmap/josm/io/session/SessionReaderTest.java

    r17659 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.assertNotNull;
    67import static org.junit.jupiter.api.Assertions.assertTrue;
     
    7677            List<Layer> layers = testRead(file);
    7778            assertEquals(layers.size(), 1);
    78             assertTrue(layers.get(0) instanceof OsmDataLayer);
    79             OsmDataLayer osm = (OsmDataLayer) layers.get(0);
     79            OsmDataLayer osm = assertInstanceOf(OsmDataLayer.class, layers.get(0));
    8080            assertEquals(osm.getName(), "OSM layer name");
    8181        }
     
    9292            List<Layer> layers = testRead(file);
    9393            assertEquals(layers.size(), 1);
    94             assertTrue(layers.get(0) instanceof GpxLayer);
    95             GpxLayer gpx = (GpxLayer) layers.get(0);
     94            GpxLayer gpx = assertInstanceOf(GpxLayer.class, layers.get(0));
    9695            assertEquals(gpx.getName(), "GPX layer name");
    9796        }
     
    135134        final List<Layer> layers = testRead("bing.jos");
    136135        assertEquals(layers.size(), 1);
    137         assertTrue(layers.get(0) instanceof ImageryLayer);
     136        assertInstanceOf(ImageryLayer.class, layers.get(0));
    138137        final AbstractTileSourceLayer<?> image = (AbstractTileSourceLayer<?>) layers.get(0);
    139138        assertEquals("Bing aerial imagery", image.getName());
     
    157156        final List<Layer> layers = testRead("notes.joz");
    158157        assertEquals(layers.size(), 1);
    159         assertTrue(layers.get(0) instanceof NoteLayer);
    160         final NoteLayer layer = (NoteLayer) layers.get(0);
     158        final NoteLayer layer = assertInstanceOf(NoteLayer.class, layers.get(0));
    161159        assertEquals("Notes", layer.getName());
    162160        assertEquals(174, layer.getNoteData().getNotes().size());
  • trunk/test/unit/org/openstreetmap/josm/io/session/SessionWriterTest.java

    r18466 r18690  
    131131            }
    132132        }
    133         SessionWriter sw = new SessionWriter(layers, -1, exporters, new MultiMap<Layer, Layer>(), zip);
     133        SessionWriter sw = new SessionWriter(layers, -1, exporters, new MultiMap<>(), zip);
    134134        File file = new File(System.getProperty("java.io.tmpdir"), getClass().getName()+(zip ? ".joz" : ".jos"));
    135135        try {
     
    214214     */
    215215    public static NoteLayer createNoteLayer() {
    216         return new NoteLayer(Arrays.asList(new Note(LatLon.ZERO)), "layer name");
     216        return new NoteLayer(Collections.singletonList(new Note(LatLon.ZERO)), "layer name");
    217217    }
    218218
     
    223223    @Test
    224224    void testWriteEmptyJos() throws IOException {
    225         testWrite(Collections.<Layer>emptyList(), false);
     225        testWrite(Collections.emptyList(), false);
    226226    }
    227227
     
    232232    @Test
    233233    void testWriteEmptyJoz() throws IOException {
    234         testWrite(Collections.<Layer>emptyList(), true);
     234        testWrite(Collections.emptyList(), true);
    235235    }
    236236
     
    241241    @Test
    242242    void testWriteOsmJos() throws IOException {
    243         testWrite(Collections.<Layer>singletonList(createOsmLayer()), false);
     243        testWrite(Collections.singletonList(createOsmLayer()), false);
    244244    }
    245245
     
    250250    @Test
    251251    void testWriteOsmJoz() throws IOException {
    252         testWrite(Collections.<Layer>singletonList(createOsmLayer()), true);
     252        testWrite(Collections.singletonList(createOsmLayer()), true);
    253253    }
    254254
     
    259259    @Test
    260260    void testWriteGpxJos() throws IOException {
    261         testWrite(Collections.<Layer>singletonList(createGpxLayer()), false);
     261        testWrite(Collections.singletonList(createGpxLayer()), false);
    262262    }
    263263
     
    268268    @Test
    269269    void testWriteGpxJoz() throws IOException {
    270         testWrite(Collections.<Layer>singletonList(createGpxLayer()), true);
     270        testWrite(Collections.singletonList(createGpxLayer()), true);
    271271    }
    272272
  • trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerJOSMTooOldTest.java

    r17195 r18690  
    33
    44import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
    5 import static org.junit.Assert.assertEquals;
    6 import static org.junit.Assert.assertFalse;
    7 import static org.junit.Assert.assertNotEquals;
     5import static org.junit.jupiter.api.Assertions.assertEquals;
     6import static org.junit.jupiter.api.Assertions.assertFalse;
     7import static org.junit.jupiter.api.Assertions.assertNotEquals;
    88
    99import java.io.File;
  • trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerMultiVersionTest.java

    r17195 r18690  
    33
    44import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
    5 import static org.junit.Assert.assertEquals;
    6 import static org.junit.Assert.assertFalse;
    7 import static org.junit.Assert.assertNotEquals;
     5import static org.junit.jupiter.api.Assertions.assertEquals;
     6import static org.junit.jupiter.api.Assertions.assertFalse;
     7import static org.junit.jupiter.api.Assertions.assertNotEquals;
    88
    99import java.io.File;
  • trunk/test/unit/org/openstreetmap/josm/testutils/ImagePatternMatching.java

    r17275 r18690  
    3838            .orElse(i -> paletteMap.getOrDefault(i, "#"));
    3939        pattern = Optional.ofNullable(pattern)
    40             .orElseGet(() -> patternCache.computeIfAbsent(patternString, k -> Pattern.compile(k)));
     40            .orElseGet(() -> patternCache.computeIfAbsent(patternString, Pattern::compile));
    4141
    4242        int[] columnOrRow = isColumn
     
    4848
    4949        if (assertMatch && !result.matches()) {
    50             System.err.println(String.format("Full strip failing to match pattern %s: %s", pattern, stringRepr));
     50            System.err.printf("Full strip failing to match pattern %s: %s%n", pattern, stringRepr);
    5151            fail(String.format(
    5252                "%s %d failed to match pattern %s",
  • trunk/test/unit/org/openstreetmap/josm/testutils/JOSMTestRules.java

    r18551 r18690  
    666666        try {
    667667            eventManager.resetState();
    668         } catch (IllegalArgumentException ignored) {
    669             Logging.trace(ignored);
     668        } catch (IllegalArgumentException e) {
     669            Logging.trace(e);
    670670        }
    671671    }
  • trunk/test/unit/org/openstreetmap/josm/testutils/PluginServer.java

    r17195 r18690  
    8080                try {
    8181                    jarFile = new JarFile(srcJar, false);
    82                     jarFile.getManifest().getMainAttributes().entrySet().forEach(
    83                         entry -> attrs.put(entry.getKey().toString(), entry.getValue().toString())
    84                     );
     82                    jarFile.getManifest().getMainAttributes()
     83                            .forEach((key, value) -> attrs.put(key.toString(), value.toString()));
    8584                } catch (IOException e) {
    8685                    Logging.warn(
  • trunk/test/unit/org/openstreetmap/josm/testutils/mockers/ExtendedDialogMocker.java

    r18454 r18690  
    8888
    8989    protected String getString(final ExtendedDialog instance) {
    90         return Optional.ofNullable(this.simpleStringContentMemo.get(instance))
    91             .orElseGet(() -> instance.toString());
     90        return Optional.ofNullable(this.simpleStringContentMemo.get(instance)).orElseGet(instance::toString);
    9291    }
    9392
     
    185184    @Mock
    186185    private void setVisible(final Invocation invocation, final boolean value) throws Throwable {
    187         if (value == true) {
     186        if (value) {
    188187            try {
    189188                final ExtendedDialog instance = invocation.getInvokedInstance();
  • trunk/test/unit/org/openstreetmap/josm/tools/AlphanumComparatorTest.java

    r17275 r18690  
    55
    66import java.util.Arrays;
    7 import java.util.Collections;
    87import java.util.List;
    98
     
    2120    void testNumeric() {
    2221        List<String> lst = Arrays.asList("1", "20", "-1", "00999", "100");
    23         Collections.sort(lst, AlphanumComparator.getInstance());
     22        lst.sort(AlphanumComparator.getInstance());
    2423        assertEquals(Arrays.asList("-1", "1", "20", "100", "00999"), lst);
    2524    }
     
    3130    void testMixed() {
    3231        List<String> lst = Arrays.asList("b1", "b20", "a5", "a00999", "a100");
    33         Collections.sort(lst, AlphanumComparator.getInstance());
     32        lst.sort(AlphanumComparator.getInstance());
    3433        assertEquals(Arrays.asList("a5", "a100", "a00999", "b1", "b20"), lst);
    3534    }
  • trunk/test/unit/org/openstreetmap/josm/tools/LanguageInfoTest.java

    r17275 r18690  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.tools;
     3
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    35
    46import java.util.Arrays;
     
    810import java.util.stream.Stream;
    911
    10 import org.junit.Assert;
    1112import org.junit.jupiter.api.extension.RegisterExtension;
    1213import org.junit.jupiter.api.Test;
     
    5960                .map(locale -> LanguageInfo.getWikiLanguagePrefix(locale, type))
    6061                .collect(Collectors.toList());
    61         Assert.assertEquals(Arrays.asList(expected), actual);
     62        assertEquals(Arrays.asList(expected), actual);
    6263    }
    6364
     
    6768    @Test
    6869    void testGetLocale() {
    69         Assert.assertEquals(RU, LanguageInfo.getLocale("ru"));
    70         Assert.assertEquals(EN_GB, LanguageInfo.getLocale("en_GB"));
    71         Assert.assertEquals(CA_ES_VALENCIA, LanguageInfo.getLocale("ca_ES@valencia"));
    72         Assert.assertEquals(DE_DE, LanguageInfo.getLocale("de_DE"));
    73         Assert.assertEquals(DE_DE, LanguageInfo.getLocale("de_DE.UTF-8")); // LANG, LC_MEASUREMENT
    74         Assert.assertEquals(PT_BR, LanguageInfo.getLocale("pt_BR.UTF-8")); // LANG, LC_MEASUREMENT
     70        assertEquals(RU, LanguageInfo.getLocale("ru"));
     71        assertEquals(EN_GB, LanguageInfo.getLocale("en_GB"));
     72        assertEquals(CA_ES_VALENCIA, LanguageInfo.getLocale("ca_ES@valencia"));
     73        assertEquals(DE_DE, LanguageInfo.getLocale("de_DE"));
     74        assertEquals(DE_DE, LanguageInfo.getLocale("de_DE.UTF-8")); // LANG, LC_MEASUREMENT
     75        assertEquals(PT_BR, LanguageInfo.getLocale("pt_BR.UTF-8")); // LANG, LC_MEASUREMENT
    7576    }
    7677
     
    8081    @Test
    8182    void testGetJOSMLocaleCode() {
    82         Assert.assertEquals("de", LanguageInfo.getJOSMLocaleCode(DE_DE));
    83         Assert.assertEquals("pt_BR", LanguageInfo.getJOSMLocaleCode(PT_BR));
    84         Assert.assertEquals("ca@valencia", LanguageInfo.getJOSMLocaleCode(CA_ES_VALENCIA));
     83        assertEquals("de", LanguageInfo.getJOSMLocaleCode(DE_DE));
     84        assertEquals("pt_BR", LanguageInfo.getJOSMLocaleCode(PT_BR));
     85        assertEquals("ca@valencia", LanguageInfo.getJOSMLocaleCode(CA_ES_VALENCIA));
    8586    }
    8687
     
    9091    @Test
    9192    void testGetJavaLocaleCode() {
    92         Assert.assertEquals("ca__valencia", LanguageInfo.getJavaLocaleCode("ca@valencia"));
     93        assertEquals("ca__valencia", LanguageInfo.getJavaLocaleCode("ca@valencia"));
    9394    }
    9495
     
    9899    @Test
    99100    void testGetLanguageCodeXML() {
    100         Assert.assertEquals("ca-valencia.", LanguageInfo.getLanguageCodeXML());
     101        assertEquals("ca-valencia.", LanguageInfo.getLanguageCodeXML());
    101102    }
    102103
     
    106107    @Test
    107108    void testGetLanguageCodeManifest() {
    108         Assert.assertEquals("ca-valencia_", LanguageInfo.getLanguageCodeManifest());
     109        assertEquals("ca-valencia_", LanguageInfo.getLanguageCodeManifest());
    109110    }
    110111
     
    114115    @Test
    115116    void testGetLanguageCodes() {
    116         Assert.assertEquals(Arrays.asList("ca_ES@valencia", "ca@valencia", "ca_ES", "ca"), LanguageInfo.getLanguageCodes(CA_ES_VALENCIA));
     117        assertEquals(Arrays.asList("ca_ES@valencia", "ca@valencia", "ca_ES", "ca"), LanguageInfo.getLanguageCodes(CA_ES_VALENCIA));
    117118    }
    118119}
  • trunk/test/unit/org/openstreetmap/josm/tools/MemoryManagerTest.java

    r17275 r18690  
    6565        MemoryHandle<Object> testMemory = manager.allocateMemory("test", 10, Object::new);
    6666        testMemory.free();
    67         assertThrows(IllegalStateException.class, () -> testMemory.get());
     67        assertThrows(IllegalStateException.class, testMemory::get);
    6868    }
    6969
     
    7777        MemoryHandle<Object> testMemory = manager.allocateMemory("test", 10, Object::new);
    7878        testMemory.free();
    79         assertThrows(IllegalStateException.class, () -> testMemory.free());
     79        assertThrows(IllegalStateException.class, testMemory::free);
    8080    }
    8181
    8282    /**
    8383     * Test that too big allocations fail
    84      * @throws NotEnoughMemoryException always
    8584     */
    8685    @Test
    87     void testAllocationFails() throws NotEnoughMemoryException {
     86    void testAllocationFails() {
    8887        MemoryManager manager = MemoryManager.getInstance();
    8988        long available = manager.getAvailableMemory();
     
    9796    /**
    9897     * Test that allocations with null object fail
    99      * @throws NotEnoughMemoryException never
    10098     */
    10199    @Test
    102     void testSupplierFails() throws NotEnoughMemoryException {
     100    void testSupplierFails() {
    103101        MemoryManager manager = MemoryManager.getInstance();
    104102
     
    119117    /**
    120118     * Test {@link MemoryManager#isAvailable(long)} for negative number
    121      * @throws NotEnoughMemoryException never
    122119     */
    123120    @Test
    124     void testIsAvailableFails() throws NotEnoughMemoryException {
     121    void testIsAvailableFails() {
    125122        MemoryManager manager = MemoryManager.getInstance();
    126123
     
    154151
    155152        assertFalse(manager.resetState().isEmpty());
    156         assertThrows(IllegalStateException.class, () -> testMemory.get());
     153        assertThrows(IllegalStateException.class, testMemory::get);
    157154    }
    158155
  • trunk/test/unit/org/openstreetmap/josm/tools/OsmUrlToBoundsTest.java

    r18037 r18690  
    22package org.openstreetmap.josm.tools;
    33
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5
    46import org.openstreetmap.josm.data.Bounds;
    57
    6 import org.junit.Assert;
    78import org.junit.jupiter.api.Test;
    89
     
    1617    @Test
    1718    void testPositionToBounds() {
    18         Assert.assertEquals(new Bounds(51.7167359, 8.7573485, 51.720724, 8.7659315),
    19                 OsmUrlToBounds.positionToBounds(51.71873, 8.76164, 17));
    20         Assert.assertEquals(new Bounds(40.8609329, -75.7523458, 40.8633671, -75.7480542),
    21                 OsmUrlToBounds.positionToBounds(40.86215, -75.75020, 18));
     19        assertEquals(new Bounds(51.7167359, 8.7573485, 51.720724, 8.7659315), OsmUrlToBounds.positionToBounds(51.71873, 8.76164, 17));
     20        assertEquals(new Bounds(40.8609329, -75.7523458, 40.8633671, -75.7480542), OsmUrlToBounds.positionToBounds(40.86215, -75.75020, 18));
    2221    }
    2322
     
    8988                Logging.trace(e);
    9089            }
    91             Assert.assertEquals(item.url, item.bounds, bounds);
     90            assertEquals(item.bounds, bounds, item.url);
    9291        }
    9392    }
     
    9897    @Test
    9998    void testGetZoom() {
    100         Assert.assertEquals(4, OsmUrlToBounds.getZoom(OsmUrlToBounds.positionToBounds(0, 0, 4)));
    101         Assert.assertEquals(10, OsmUrlToBounds.getZoom(OsmUrlToBounds.positionToBounds(5, 5, 10)));
    102         Assert.assertEquals(18, OsmUrlToBounds.getZoom(OsmUrlToBounds.positionToBounds(40, 20, 18)));
     99        assertEquals(4, OsmUrlToBounds.getZoom(OsmUrlToBounds.positionToBounds(0, 0, 4)));
     100        assertEquals(10, OsmUrlToBounds.getZoom(OsmUrlToBounds.positionToBounds(5, 5, 10)));
     101        assertEquals(18, OsmUrlToBounds.getZoom(OsmUrlToBounds.positionToBounds(40, 20, 18)));
    103102    }
    104103}
  • trunk/test/unit/org/openstreetmap/josm/tools/template_engine/TemplateEntryTest.java

    r17275 r18690  
    22package org.openstreetmap.josm.tools.template_engine;
    33
     4import static org.junit.jupiter.api.Assertions.assertTrue;
     5
    46import java.util.Set;
    57
    6 import org.junit.Assert;
    78import org.junit.jupiter.api.extension.RegisterExtension;
    89import org.junit.jupiter.api.Test;
     
    3435        TestUtils.assumeWorkingEqualsVerifier();
    3536        Set<Class<? extends TemplateEntry>> templates = TestUtils.getJosmSubtypes(TemplateEntry.class);
    36         Assert.assertTrue(templates.size() >= 3); // if it finds less than 3 classes, something is broken
     37        assertTrue(templates.size() >= 3); // if it finds less than 3 classes, something is broken
    3738        for (Class<?> c : templates) {
    3839            Logging.debug(c.toString());
  • trunk/test/unit/org/openstreetmap/josm/tools/template_engine/TemplateParserTest.java

    r17275 r18690  
    88import java.util.List;
    99
    10 import org.junit.Assert;
    1110import org.junit.jupiter.api.BeforeAll;
    1211import org.junit.jupiter.api.Test;
     
    145144        StringBuilder sb = new StringBuilder();
    146145        entry.appendText(sb, dataProvider);
    147         Assert.assertEquals("waypointName uu i10i", sb.toString());
     146        assertEquals("waypointName uu i10i", sb.toString());
    148147    }
    149148
     
    161160        r.put("admin_level", "2");
    162161        templateEntry.appendText(sb, r);
    163         Assert.assertEquals("NUTS 1", sb.toString());
     162        assertEquals("NUTS 1", sb.toString());
    164163
    165164        sb.setLength(0);
    166165        r.put("admin_level", "5");
    167166        templateEntry.appendText(sb, r);
    168         Assert.assertEquals("5", sb.toString());
     167        assertEquals("5", sb.toString());
    169168    }
    170169
     
    179178        StringBuilder sb = new StringBuilder();
    180179        entry.appendText(sb, dataProvider);
    181         Assert.assertEquals("name=waypointName, number=10", sb.toString());
    182         Assert.assertEquals("{special:everything}", entry.toString());
     180        assertEquals("name=waypointName, number=10", sb.toString());
     181        assertEquals("{special:everything}", entry.toString());
    183182    }
    184183
     
    193192        StringBuilder sb = new StringBuilder();
    194193        entry.appendText(sb, dataProvider);
    195         Assert.assertEquals("waypointName\n10", sb.toString());
     194        assertEquals("waypointName\n10", sb.toString());
    196195    }
    197196
     
    207206        StringBuilder sb = new StringBuilder();
    208207        templateEntry.appendText(sb, dataProvider);
    209         Assert.assertEquals("waypointNameulocalNameuspecialKey", sb.toString());
     208        assertEquals("waypointNameulocalNameuspecialKey", sb.toString());
    210209    }
    211210
     
    239238        entry.appendText(sb, child);
    240239
    241         Assert.assertEquals("name_parent2", sb.toString());
     240        assertEquals("name_parent2", sb.toString());
    242241    }
    243242
     
    258257        entry.appendText(sb, child);
    259258
    260         Assert.assertEquals("name_parent1", sb.toString());
     259        assertEquals("name_parent1", sb.toString());
    261260    }
    262261
     
    285284        entry.appendText(sb, child2);
    286285
    287         Assert.assertEquals("name_parent1name_parent2", sb.toString());
     286        assertEquals("name_parent1name_parent2", sb.toString());
    288287    }
    289288
     
    318317        entry.appendText(sb, child2);
    319318
    320         Assert.assertEquals("grandparent_namename_parent2", sb.toString());
     319        assertEquals("grandparent_namename_parent2", sb.toString());
    321320    }
    322321
     
    324323    void testErrorsNot() {
    325324        TemplateParser parser = new TemplateParser("!{-parent() '{name}'}");
    326         assertThrows(ParseError.class, () -> parser.parse());
     325        assertThrows(ParseError.class, parser::parse);
    327326    }
    328327
     
    330329    void testErrorOr() {
    331330        TemplateParser parser = new TemplateParser("!{parent() | type=type1 '{name}'}");
    332         assertThrows(ParseError.class, () -> parser.parse());
     331        assertThrows(ParseError.class, parser::parse);
    333332    }
    334333
     
    356355        entry.appendText(sb, parent2);
    357356
    358         Assert.assertEquals("child2", sb.toString());
     357        assertEquals("child2", sb.toString());
    359358    }
    360359
     
    364363        final String s2 = new TemplateParser(s1).parse().toString();
    365364        final String s3 = new TemplateParser(s2).parse().toString();
    366         Assert.assertEquals(s1, s2);
    367         Assert.assertEquals(s2, s3);
     365        assertEquals(s1, s2);
     366        assertEquals(s2, s3);
    368367    }
    369368}
Note: See TracChangeset for help on using the changeset viewer.