@@ -0,0 +1,2128 @@
+package me.coley.recaf;%0A%0Aimport me.coley.recaf.ui.controls.text.model.LanguageStyler;%0Aimport me.coley.recaf.ui.controls.text.model.Languages;%0Aimport org.junit.jupiter.params.ParameterizedTest;%0Aimport org.junit.jupiter.params.provider.*;%0A%0Aimport java.util.*;%0Aimport java.util.stream.Stream;%0A%0Aimport static org.junit.jupiter.api.Assertions.fail;%0A%0A/**%0A * Regression tests to assert the odd load-order-based errors with the language styler don't resurface.%0A * Sometimes the order of which language is used would somehow effect the regex system.%0A * It was incredibly odd, and the fix %3Ci%3Eseems%3C/i%3E to be remove %7B@code %5CB%7D usage.%0A *%0A * @author Matt%0A */%0Apublic class StylerTest %7B%0A%09private static final Map%3CString, String%3E langToExample = new HashMap%3C%3E();%0A%09static %7B%0A%09%09langToExample.put(%22css%22, %22.type %7B%5Cn%5Ctfont-family: Arial;%5Cn%7D%22);%0A%09%09langToExample.put(%22java%22, %22class Name %7B%5Cn%5Ctstatic int i = 0;%5Cn%7D%22);%0A%09%09langToExample.put(%22json%22, %22%7B %5C%22key%5C%22: %5C%22val%5C%22, %5C%22list%5C%22: %5B %7B %7D  %5D %7D%22);%0A%09%09langToExample.put(%22xml%22, %22%3Ctag%3Evalue%3C/tag%3E%22);%0A%09%09langToExample.put(%22mf%22, %22Manifest-Version: 1.0%5CnMain-Class: me.coley.recaf.Recaf%5CnCan-Redefine-Classes: true%22);%0A%09%09langToExample.put(%22properties%22, %22locale=en_US%5Cnwriter1=file%5Cnwriter1.file=#%7Brecaf.home%7D/rclog.txt%22);%0A%09%09langToExample.put(%22bytecode%22, %22DEFINE static main(%5BLjava/lang/String; args)V%5CnRETURN%22);%0A%09%7D%0A%0A%09@ParameterizedTest%0A%09@MethodSource(%22generateCombinations%22)%0A%09public void testStyleLoadOrder(String first, String second) %7B%0A%09%09try %7B%0A%09%09%09LanguageStyler styler = new LanguageStyler(Languages.find(first));%0A%09%09%09styler.computeStyle(langToExample.get(first));%0A%09%09%09//%0A%09%09%09styler = new LanguageStyler(Languages.find(second));%0A%09%09%09styler.computeStyle(langToExample.get(second));%0A%09%09%7D catch(Throwable ex) %7B%0A%09%09%09// If the system regresses to how it used to fail, it will throw a NPE%0A%09%09%09// when the styler tries to use Matcher.find()%0A%09%09%09fail(ex);%0A%09%09%7D%0A%09%7D%0A%0A%09public static Stream%3CArguments%3E generateCombinations() %7B%0A%09%09List%3CArguments%3E pairs = new ArrayList%3C%3E();%0A%09%09for (String first : langToExample.keySet())%0A%09%09%09for (String second : langToExample.keySet())%0A%09%09%09%09pairs.add(Arguments.of(first, second));%0A%09%09return pairs.stream();%0A%09%7D%0A%7D%0A

add regression test for styler load order