diff --git a/src/test/java/org/jabref/logic/l10n/LocalizationConsistencyTest.java b/src/test/java/org/jabref/logic/l10n/LocalizationConsistencyTest.java index 52bdb1e755b..cc73fe68728 100644 --- a/src/test/java/org/jabref/logic/l10n/LocalizationConsistencyTest.java +++ b/src/test/java/org/jabref/logic/l10n/LocalizationConsistencyTest.java @@ -43,37 +43,6 @@ public void allFilesMustHaveSameKeys() { } } - - private static class DuplicationDetectionProperties extends Properties { - - private static final long serialVersionUID = 1L; - - private final List duplicates = new LinkedList<>(); - - - public DuplicationDetectionProperties() { - super(); - } - - /** - * Overriding the HashTable put() so we can check for duplicates - */ - @Override - public synchronized Object put(Object key, Object value) { - // Have we seen this key before? - if (containsKey(key)) { - duplicates.add(String.valueOf(key)); - } - - return super.put(key, value); - } - - public List getDuplicates() { - return duplicates; - } - } - - @Test public void ensureNoDuplicates() { for (String bundle : Arrays.asList("JabRef", "Menu")) { @@ -135,8 +104,7 @@ public void findMissingLocalizationKeys() throws IOException { @Test public void findMissingMenuLocalizationKeys() throws IOException { - List missingKeys = LocalizationParser.find(LocalizationBundleForTest.MENU).stream() - .collect(Collectors.toList()); + Set missingKeys = LocalizationParser.find(LocalizationBundleForTest.MENU); assertEquals("DETECTED LANGUAGE KEYS WHICH ARE NOT IN THE ENGLISH MENU FILE\n" + "1. PASTE THESE INTO THE ENGLISH MENU FILE\n" + @@ -144,7 +112,7 @@ public void findMissingMenuLocalizationKeys() throws IOException { missingKeys.parallelStream() .map(key -> String.format("%s=%s", key.getKey(), key.getKey())) .collect(Collectors.toList()), - Collections.emptyList(), missingKeys); + Collections.emptySet(), missingKeys); } @Test @@ -188,4 +156,33 @@ public void localizationParameterMustIncludeAString() throws IOException { } } + private static class DuplicationDetectionProperties extends Properties { + + private static final long serialVersionUID = 1L; + + private final List duplicates = new LinkedList<>(); + + + public DuplicationDetectionProperties() { + super(); + } + + /** + * Overriding the HashTable put() so we can check for duplicates + */ + @Override + public synchronized Object put(Object key, Object value) { + // Have we seen this key before? + if (containsKey(key)) { + duplicates.add(String.valueOf(key)); + } + + return super.put(key, value); + } + + public List getDuplicates() { + return duplicates; + } + } + } diff --git a/src/test/java/org/jabref/logic/l10n/LocalizationParser.java b/src/test/java/org/jabref/logic/l10n/LocalizationParser.java index a02bee4d0eb..45e63d302cc 100644 --- a/src/test/java/org/jabref/logic/l10n/LocalizationParser.java +++ b/src/test/java/org/jabref/logic/l10n/LocalizationParser.java @@ -61,7 +61,7 @@ public static SortedSet findObsolete(LocalizationBundleForTest type) thr } englishKeys.removeAll(keysInFiles); - return englishKeys.stream().collect(Collectors.toCollection(TreeSet::new)); + return new TreeSet<>(englishKeys); } private static Set findLocalizationEntriesInFiles(LocalizationBundleForTest type) throws IOException { @@ -195,9 +195,14 @@ public boolean containsKey(String key) { } }; + PlatformImpl.startup(() -> { + }); try { - PlatformImpl.startup(() -> {}); FXMLLoader loader = new FXMLLoader(path.toUri().toURL(), registerUsageResourceBundle); + // We don't want to initialize controller + loader.setControllerFactory(controllerType -> null); + // Don't check if root is null (needed for custom controls, where the root value is normally set in the FXMLLoader) + loader.impl_setStaticLoad(true); loader.load(); } catch (IOException ignore) { ignore.printStackTrace();