Issue #5141: fixed broken translation check because of ordering
diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/TranslationCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/TranslationCheckTest.java
index f94a1a1..9395843 100644
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/TranslationCheckTest.java
+++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/TranslationCheckTest.java
@@ -57,7 +57,7 @@
 
 import com.google.common.collect.ImmutableMap;
 import com.google.common.io.Closeables;
-import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
+import com.puppycrawl.tools.checkstyle.AbstractXmlTestSupport;
 import com.puppycrawl.tools.checkstyle.Checker;
 import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
 import com.puppycrawl.tools.checkstyle.XMLLogger;
@@ -68,11 +68,12 @@
 import com.puppycrawl.tools.checkstyle.api.MessageDispatcher;
 import com.puppycrawl.tools.checkstyle.api.SeverityLevel;
 import com.puppycrawl.tools.checkstyle.api.SeverityLevelCounter;
+import com.puppycrawl.tools.checkstyle.internal.utils.XmlUtil;
 import com.puppycrawl.tools.checkstyle.utils.CommonUtils;
 
 @RunWith(PowerMockRunner.class)
 @PrepareForTest(Closeables.class)
-public class TranslationCheckTest extends AbstractModuleTestSupport {
+public class TranslationCheckTest extends AbstractXmlTestSupport {
     @Captor
     private ArgumentCaptor<SortedSet<LocalizedMessage>> captor;
 
@@ -144,6 +145,7 @@
         checkConfig.addAttribute("requiredTranslations", "ja,de");
         checkConfig.addAttribute("baseName", "^InputTranslation.*$");
         final Checker checker = createChecker(checkConfig);
+        checker.setBasedir(getPath(""));
         final ByteArrayOutputStream out = new ByteArrayOutputStream();
         final XMLLogger logger = new XMLLogger(out, AutomaticBean.OutputStreamOptions.NONE);
         checker.addListener(logger);
@@ -162,8 +164,21 @@
         final String secondErrorMessage = getCheckMessage(MSG_KEY, "anotherKey");
 
         verify(checker, propertyFiles, ImmutableMap.of(
-            getPath(""), Collections.singletonList(line + firstErrorMessage),
-            translationProps, Collections.singletonList(line + secondErrorMessage)));
+            ":0", Collections.singletonList(" " + firstErrorMessage),
+            "InputTranslationCheckFireErrors_de.properties",
+                Collections.singletonList(line + secondErrorMessage)));
+
+        verifyXml(getPath("ExpectedTranslationLog.xml"), out, (expected, actual) -> {
+            // order is not always maintained here for an unknown reason.
+            // File names can appear in different orders depending on the OS and VM.
+            // This ensures we pick up the correct file based on its name and the
+            // number of children it has.
+            return !"file".equals(expected.getNodeName())
+                    || expected.getAttributes().getNamedItem("name").getNodeValue()
+                            .equals(actual.getAttributes().getNamedItem("name").getNodeValue())
+                    && XmlUtil.getChildrenElements(expected).size() == XmlUtil
+                            .getChildrenElements(actual).size();
+        }, firstErrorMessage, secondErrorMessage);
     }
 
     @Test
diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/ExpectedTranslationLog.xml b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/ExpectedTranslationLog.xml
new file mode 100644
index 0000000..7f7a772
--- /dev/null
+++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/ExpectedTranslationLog.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<checkstyle version="8.3-SNAPSHOT">
+<file name="InputTranslationCheckFireErrors.properties">
+</file>
+<file name="InputTranslationCheckFireErrors_de.properties">
+</file>
+<file name="">
+<error line="0" severity="error" message="$0" source="com.puppycrawl.tools.checkstyle.checks.TranslationCheck"/>
+</file>
+<file name="InputTranslationCheckFireErrors.properties">
+</file>
+<file name="InputTranslationCheckFireErrors_de.properties">
+<error line="0" severity="error" message="$1" source="com.puppycrawl.tools.checkstyle.checks.TranslationCheck"/>
+</file>
+</checkstyle>
diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/OutputTranslationCheckLinux.xml b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/OutputTranslationCheckLinux.xml
deleted file mode 100644
index 34a16cb..0000000
--- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/OutputTranslationCheckLinux.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<checkstyle version="8.3-SNAPSHOT">
-<file name="path_to_file/InputTranslationCheckFireErrors.properties">
-</file>
-<file name="path_to_file/InputTranslationCheckFireErrors_de.properties">
-</file>
-<file name="path_to_file">
-<error line="0" severity="error" message="%s" source="com.puppycrawl.tools.checkstyle.checks.TranslationCheck"/>
-</file>
-<file name="path_to_file/InputTranslationCheckFireErrors.properties">
-</file>
-<file name="path_to_file/InputTranslationCheckFireErrors_de.properties">
-<error line="0" severity="error" message="%s" source="com.puppycrawl.tools.checkstyle.checks.TranslationCheck"/>
-</file>
-</checkstyle>
diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/OutputTranslationCheckMacOS.xml b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/OutputTranslationCheckMacOS.xml
deleted file mode 100644
index 865791f..0000000
--- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/OutputTranslationCheckMacOS.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<checkstyle version="8.3-SNAPSHOT">
-<file name="path_to_file/InputTranslationCheckFireErrors.properties">
-</file>
-<file name="path_to_file/InputTranslationCheckFireErrors_de.properties">
-</file>
-<file name="path_to_file">
-<error line="0" severity="error" message="%s" source="com.puppycrawl.tools.checkstyle.checks.TranslationCheck"/>
-</file>
-<file name="path_to_file/InputTranslationCheckFireErrors_de.properties">
-<error line="0" severity="error" message="%s" source="com.puppycrawl.tools.checkstyle.checks.TranslationCheck"/>
-</file>
-<file name="path_to_file/InputTranslationCheckFireErrors.properties">
-</file>
-</checkstyle>
diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/OutputTranslationCheckWindows.xml b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/OutputTranslationCheckWindows.xml
deleted file mode 100644
index 443bba3..0000000
--- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/translation/OutputTranslationCheckWindows.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<checkstyle version="8.3-SNAPSHOT">
-<file name="path_to_file\InputTranslationCheckFireErrors.properties">
-</file>
-<file name="path_to_file\InputTranslationCheckFireErrors_de.properties">
-</file>
-<file name="path_to_file">
-<error line="0" severity="error" message="%s" source="com.puppycrawl.tools.checkstyle.checks.TranslationCheck"/>
-</file>
-<file name="path_to_file\InputTranslationCheckFireErrors.properties">
-</file>
-<file name="path_to_file\InputTranslationCheckFireErrors_de.properties">
-<error line="0" severity="error" message="%s" source="com.puppycrawl.tools.checkstyle.checks.TranslationCheck"/>
-</file>
-</checkstyle>