-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make the message for ModLoadingException show a translated (english) …
…message. (#147)
- Loading branch information
Showing
3 changed files
with
74 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
loader/src/test/java/net/neoforged/fml/ModLoadingExceptionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright (c) NeoForged and contributors | ||
* SPDX-License-Identifier: LGPL-2.1-only | ||
*/ | ||
|
||
package net.neoforged.fml; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import java.util.List; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class ModLoadingExceptionTest { | ||
@Test | ||
void getMessage() { | ||
var w = ModLoadingIssue.warning("fml.modloading.brokenfile.unknown", "XXXX"); | ||
var e1 = ModLoadingIssue.error("fml.modloading.brokenfile", "YYYY"); | ||
var e2 = ModLoadingIssue.error("Some untranslated text\nwhich has newlines in it"); | ||
|
||
var message = new ModLoadingException(List.of(w, e1, e2)).getMessage(); | ||
assertEquals(""" | ||
Loading errors encountered: | ||
\t- File YYYY is not a valid mod file | ||
\t- Some untranslated text | ||
\t which has newlines in it | ||
Loading warnings encountered: | ||
\t- File XXXX is not a valid mod file | ||
""", message); | ||
} | ||
} |