summaryrefslogtreecommitdiff
path: root/src/test/java/sevenUnitsGUI/I18nTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/sevenUnitsGUI/I18nTest.java')
-rw-r--r--src/test/java/sevenUnitsGUI/I18nTest.java37
1 files changed, 18 insertions, 19 deletions
diff --git a/src/test/java/sevenUnitsGUI/I18nTest.java b/src/test/java/sevenUnitsGUI/I18nTest.java
index 78f5da4..2f90d76 100644
--- a/src/test/java/sevenUnitsGUI/I18nTest.java
+++ b/src/test/java/sevenUnitsGUI/I18nTest.java
@@ -28,68 +28,67 @@ import org.junit.jupiter.params.provider.MethodSource;
/**
* Tests for the internationalization system.
- *
+ *
* @since v1.0.0
*/
class I18nTest {
+ private static final Stream<String> testLocaleSupported() {
+ return Stream.of("en", "fr");
+ }
+
private static final Stream<Arguments> testLocalization() {
- return Stream.of(
- Arguments.of("tv.title", "en", "7Units [v]"),
+ return Stream.of(Arguments.of("tv.title", "en", "7Units [v]"),
Arguments.of("tv.title", "fr", "7Unités [v]"),
Arguments.of("tv.convert_units.title", "en", "Convert Units"),
Arguments.of("tv.convert_units.title", "fr", "Convertir Unités"));
}
-
- private static final Stream<String> testLocaleSupported() {
- return Stream.of("en", "fr");
- }
/**
* Tests that the default locale is supported.
- *
+ *
* @since v1.0.0
* @see Presenter#DEFAULT_LOCALE
*/
@Test
void testDefaultLocaleSupported() {
- Presenter p = new Presenter(new ViewBot());
+ final var p = new Presenter(new ViewBot());
assertNotNull(p.locales.get(Presenter.DEFAULT_LOCALE),
"Default locale is not supported.");
}
-
+
/**
* Ensures that the system supports the provided locale.
- *
+ *
* @param localeName locale to test for support
- *
+ *
* @since 2025-06-04
* @since v1.0.0
*/
@ParameterizedTest
@MethodSource
void testLocaleSupported(String localeName) {
- Presenter p = new Presenter(new ViewBot());
+ final var p = new Presenter(new ViewBot());
assertNotNull(p.locales.get(localeName),
"Locale \"" + localeName + "\" is not supported.");
}
/**
- * Tests that the system can correctly localize text,
- * using the default locales.
- *
+ * Tests that the system can correctly localize text, using the default
+ * locales.
+ *
* @param key key of text to localize
* @param locale locale to use
* @param expected expected value of output text
- *
+ *
* @since 2025-06-04
* @since v1.0.0
*/
@ParameterizedTest
@MethodSource
void testLocalization(String key, String locale, String expected) {
- Presenter p = new Presenter(new ViewBot());
+ final var p = new Presenter(new ViewBot());
p.setUserLocale(locale);
- String actual = p.getLocalizedText(key);
+ final var actual = p.getLocalizedText(key);
assertEquals(expected, actual);
}