- Timestamp:
- 2016-05-29T10:37:31+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java
r10271 r10297 17 17 import java.util.Arrays; 18 18 import java.util.Collection; 19 import java.util.Collections; 19 20 import java.util.HashMap; 20 21 import java.util.Map; … … 87 88 88 89 /** 89 * All available tests 90 * TODO: is there any way to find out automatically all available tests? 90 * All registered tests 91 */ 92 private static final Collection<Class<? extends Test>> allTests = new ArrayList<>(); 93 private static final Map<String, Test> allTestsMap = new HashMap<>(); 94 95 /** 96 * All available tests in core 91 97 */ 92 98 @SuppressWarnings("unchecked") 93 private static final Class<Test>[] allAvailableTests= new Class[] {99 private static final Class<Test>[] CORE_TEST_CLASSES = new Class[] { 94 100 /* FIXME - unique error numbers for tests aren't properly unique - ignoring will not work as expected */ 95 101 DuplicateNode.class, // ID 1 .. 99 … … 133 139 }; 134 140 135 private static Map<String, Test> allTestsMap; 141 public static void addTest(Class<? extends Test> testClass) { 142 allTests.add(testClass); 143 try { 144 allTestsMap.put(testClass.getName(), testClass.getConstructor().newInstance()); 145 } catch (ReflectiveOperationException e) { 146 Main.error(e); 147 } 148 } 149 136 150 static { 137 allTestsMap = new HashMap<>(); 138 for (Class<Test> testClass : allAvailableTests) { 139 try { 140 allTestsMap.put(testClass.getName(), testClass.getConstructor().newInstance()); 141 } catch (ReflectiveOperationException e) { 142 Main.error(e); 143 } 151 for (Class<? extends Test> testClass : CORE_TEST_CLASSES) { 152 addTest(testClass); 144 153 } 145 154 } … … 274 283 * Gets the list of all available test classes 275 284 * 276 * @return A n arrayof the test classes277 */ 278 public static C lass<Test>[]getAllAvailableTests() {279 return Utils.copyArray(allAvailableTests);285 * @return A collection of the test classes 286 */ 287 public static Collection<Class<? extends Test>> getAllAvailableTestClasses() { 288 return Collections.unmodifiableCollection(allTests); 280 289 } 281 290
Note:
See TracChangeset
for help on using the changeset viewer.