(Object properties, boolean ws)
| 706 | |
| 707 | |
| 708 | public static Map<String, Object> getTestFilesHelper(Object properties, boolean ws) { |
| 709 | // Accept either List<?> or any Collection<?>; otherwise treat as empty. |
| 710 | final List<String> keys = new ArrayList<>(); |
| 711 | |
| 712 | if (properties instanceof Collection<?> c) { |
| 713 | for (Object o : c) { |
| 714 | if (o != null) keys.add(String.valueOf(o)); |
| 715 | } |
| 716 | } |
| 717 | |
| 718 | keys.add("features"); |
| 719 | |
| 720 | final String basePackage = ws ? "tests.exchange.ws" : "tests.exchange"; |
| 721 | final Map<String, Object> testClasses = new HashMap<>(); |
| 722 | |
| 723 | for (String key : keys) { |
| 724 | if (key == null || key.isBlank()) continue; |
| 725 | |
| 726 | // "fetchTicker" -> "TestFetchTicker" |
| 727 | String className = basePackage + ".Test" + capitalizeFirst(key); |
| 728 | |
| 729 | Class<?> clazz = tryLoadClass(className); |
| 730 | if (clazz != null) { |
| 731 | testClasses.put(key, clazz); |
| 732 | } |
| 733 | } |
| 734 | |
| 735 | return testClasses; |
| 736 | } |
| 737 | |
| 738 | private static String capitalizeFirst(String s) { |
| 739 | if (s == null || s.isEmpty()) return s; |
no test coverage detected