Changeset 15098 in josm for trunk/test


Ignore:
Timestamp:
2019-05-20T01:20:35+02:00 (6 years ago)
Author:
Don-vip
Message:

nicer test names

Location:
trunk/test/unit/org/openstreetmap/josm/gui/preferences/map
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/map/MapPaintPreferenceTestIT.java

    r15095 r15098  
    88import java.util.ArrayList;
    99import java.util.List;
    10 import java.util.stream.Collectors;
    1110
    1211import org.junit.BeforeClass;
     
    3534 */
    3635@RunWith(ParallelParameterized.class)
    37 public class MapPaintPreferenceTestIT {
     36public class MapPaintPreferenceTestIT extends AbstractExtendedSourceEntryTestCase {
    3837
    3938    /**
     
    4342    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4443    public static JOSMTestRules test = new JOSMTestRules().https().timeout(15000*60).parameters();
    45 
    46     /** Entry to test */
    47     private final ExtendedSourceEntry source;
    48     private final List<String> ignoredErrors = new ArrayList<>();
    49     private static final List<String> errorsToIgnore = new ArrayList<>();
    5044
    5145    /**
     
    6660    public static List<Object[]> data() throws Exception {
    6761        ImageProvider.clearCache();
    68         return new MapPaintPreference.MapPaintSourceEditor().loadAndGetAvailableSources().stream()
    69                 .map(x -> new Object[] {x.getDisplayName(), x.url, x}).collect(Collectors.toList());
     62        return getTestParameters(new MapPaintPreference.MapPaintSourceEditor().loadAndGetAvailableSources());
    7063    }
    7164
     
    7770     */
    7871    public MapPaintPreferenceTestIT(String displayName, String url, ExtendedSourceEntry source) {
    79         this.source = source;
     72        super(source);
    8073    }
    8174
     
    116109        assumeTrue(ignoredErrors.toString(), ignoredErrors.isEmpty());
    117110    }
    118 
    119     private static boolean isIgnoredSubstring(String substring) {
    120         return errorsToIgnore.parallelStream().anyMatch(x -> substring.contains(x));
    121     }
    122111}
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/map/TaggingPresetPreferenceTestIT.java

    r15097 r15098  
    77
    88import java.io.IOException;
    9 import java.util.ArrayList;
    109import java.util.Collection;
    1110import java.util.HashSet;
     
    1716import java.util.concurrent.TimeUnit;
    1817import java.util.concurrent.TimeoutException;
    19 import java.util.stream.Collectors;
    2018
    2119import org.junit.BeforeClass;
     
    4139 */
    4240@RunWith(Parameterized.class)
    43 public class TaggingPresetPreferenceTestIT {
     41public class TaggingPresetPreferenceTestIT extends AbstractExtendedSourceEntryTestCase {
    4442
    4543    /**
     
    4947    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    5048    public static JOSMTestRules test = new JOSMTestRules().https().timeout(10000*60).parameters();
    51 
    52     /** Entry to test */
    53     private final ExtendedSourceEntry source;
    54     private final List<String> ignoredErrors = new ArrayList<>();
    55     private static final List<String> errorsToIgnore = new ArrayList<>();
    5649
    5750    /**
     
    7770    public static List<Object[]> data() throws Exception {
    7871        ImageProvider.clearCache();
    79         return new TaggingPresetPreference.TaggingPresetSourceEditor().loadAndGetAvailableSources().stream()
    80                 .map(x -> new Object[] {x.getDisplayName(), x.url, x}).collect(Collectors.toList());
     72        return getTestParameters(new TaggingPresetPreference.TaggingPresetSourceEditor().loadAndGetAvailableSources());
    8173    }
    8274
     
    8880     */
    8981    public TaggingPresetPreferenceTestIT(String displayName, String url, ExtendedSourceEntry source) {
    90         this.source = source;
     82        super(source);
    9183    }
    9284
     
    113105        assertTrue(errors.toString(), errors.isEmpty());
    114106        assumeTrue(ignoredErrors.toString(), ignoredErrors.isEmpty());
    115     }
    116 
    117     private void handleException(Exception e, Set<String> errors) {
    118         e.printStackTrace();
    119         String s = source.url + " => " + e.toString();
    120         if (isIgnoredSubstring(s)) {
    121             ignoredErrors.add(s);
    122         } else {
    123             errors.add(s);
    124         }
    125107    }
    126108
     
    152134        }
    153135    }
    154 
    155     private static boolean isIgnoredSubstring(String substring) {
    156         return errorsToIgnore.parallelStream().anyMatch(x -> substring.contains(x));
    157     }
    158136}
Note: See TracChangeset for help on using the changeset viewer.