Changeset 14435 in josm for trunk/test


Ignore:
Timestamp:
2018-11-20T01:51:27+01:00 (12 months ago)
Author:
Don-vip
Message:

fix SonarQube issues

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/tools/OptionParserTest.java

    r14415 r14435  
    33
    44import static org.junit.Assert.assertEquals;
     5import static org.junit.Assert.assertFalse;
     6import static org.junit.Assert.assertTrue;
    57
    68import java.util.ArrayList;
     
    2022public class OptionParserTest {
    2123
    22     // A reason for moving to jupter...
     24    // A reason for moving to jupiter...
    2325    @Test(expected = OptionParseException.class)
    2426    public void testEmptyParserRejectsLongopt() {
     
    4345
    4446    @Test
    45     public void testparserOption() {
     47    public void testParserOption() {
    4648        AtomicReference<String> argFound = new AtomicReference<>();
    4749        OptionParser parser = new OptionParser("test")
     
    5355
    5456    @Test(expected = OptionParseException.class)
    55     public void testparserOptionFailsIfMissing() {
     57    public void testParserOptionFailsIfMissing() {
    5658        AtomicReference<String> argFound = new AtomicReference<>();
    5759        OptionParser parser = new OptionParser("test")
     
    6264
    6365    @Test(expected = OptionParseException.class)
    64     public void testparserOptionFailsIfMissingArgument() {
     66    public void testParserOptionFailsIfMissingArgument() {
    6567        AtomicReference<String> argFound = new AtomicReference<>();
    6668        OptionParser parser = new OptionParser("test")
     
    7173
    7274    @Test(expected = OptionParseException.class)
    73     public void testparserOptionFailsIfMissing2() {
     75    public void testParserOptionFailsIfMissing2() {
    7476        AtomicReference<String> argFound = new AtomicReference<>();
    7577        OptionParser parser = new OptionParser("test")
     
    8082
    8183    @Test(expected = OptionParseException.class)
    82     public void testparserOptionFailsIfTwice() {
     84    public void testParserOptionFailsIfTwice() {
    8385        AtomicReference<String> argFound = new AtomicReference<>();
    8486        OptionParser parser = new OptionParser("test")
     
    8991
    9092    @Test(expected = OptionParseException.class)
    91     public void testparserOptionFailsIfTwiceForAlias() {
     93    public void testParserOptionFailsIfTwiceForAlias() {
    9294        AtomicReference<String> argFound = new AtomicReference<>();
    9395        OptionParser parser = new OptionParser("test")
     
    226228        assertEquals("arg", argFound.get());
    227229        assertEquals(Arrays.asList("m1", "m2"), multiFound);
    228         assertEquals(true, usedFlag.get());
    229         assertEquals(false, unusedFlag.get());
     230        assertTrue(usedFlag.get());
     231        assertFalse(unusedFlag.get());
    230232    }
    231233
     
    245247        assertEquals(Arrays.asList(), remaining);
    246248        assertEquals("arg", argFound.get());
    247         assertEquals(true, usedFlag.get());
    248         assertEquals(false, unusedFlag.get());
    249     }
    250 
    251     @Test(expected = OptionParseException.class)
    252     public void testAbigiousAlternatives() {
     249        assertTrue(usedFlag.get());
     250        assertFalse(unusedFlag.get());
     251    }
     252
     253    @Test(expected = OptionParseException.class)
     254    public void testAmbiguousAlternatives() {
    253255        AtomicReference<String> argFound = new AtomicReference<>();
    254256        AtomicBoolean usedFlag = new AtomicBoolean();
     
    280282        assertEquals(Arrays.asList("x"), remaining);
    281283        assertEquals("arg", argFound.get());
    282         assertEquals(true, usedFlag.get());
    283         assertEquals(false, unusedFlag.get());
     284        assertTrue(usedFlag.get());
     285        assertFalse(unusedFlag.get());
    284286
    285287        remaining = parser.parseOptions(Arrays.asList("-ft", "arg", "x"));
     
    287289        assertEquals(Arrays.asList("x"), remaining);
    288290        assertEquals("arg", argFound.get());
    289         assertEquals(true, usedFlag.get());
    290         assertEquals(false, unusedFlag.get());
     291        assertTrue(usedFlag.get());
     292        assertFalse(unusedFlag.get());
    291293
    292294        remaining = parser.parseOptions(Arrays.asList("-f", "-t=arg", "x"));
     
    294296        assertEquals(Arrays.asList("x"), remaining);
    295297        assertEquals("arg", argFound.get());
    296         assertEquals(true, usedFlag.get());
    297         assertEquals(false, unusedFlag.get());
     298        assertTrue(usedFlag.get());
     299        assertFalse(unusedFlag.get());
    298300    }
    299301
     
    319321
    320322    @Test(expected = IllegalArgumentException.class)
    321     public void testDupplicateOptionName() {
     323    public void testDuplicateOptionName() {
    322324        new OptionParser("test").addFlagParameter("test", this::nop).addFlagParameter("test", this::nop);
    323325    }
    324326
    325327    @Test(expected = IllegalArgumentException.class)
    326     public void testDupplicateOptionName2() {
     328    public void testDuplicateOptionName2() {
    327329        new OptionParser("test").addFlagParameter("test", this::nop)
    328330            .addArgumentParameter("test", OptionCount.OPTIONAL, this::nop);
     
    345347
    346348    @Test(expected = IllegalArgumentException.class)
    347     public void testDupplicateShortAlias() {
     349    public void testDuplicateShortAlias() {
    348350        new OptionParser("test").addFlagParameter("test", this::nop)
    349351        .addFlagParameter("test2", this::nop)
Note: See TracChangeset for help on using the changeset viewer.