|
|
@@ -12,7 +12,7 @@ import java.util.List;
|
|
|
import java.util.Properties;
|
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
|
|
-import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
|
+import static org.junit.jupiter.api.Assertions.assertFalse;
|
|
|
|
|
|
class OmgPaymentAttemptI18nContractTest {
|
|
|
|
|
|
@@ -25,20 +25,17 @@ class OmgPaymentAttemptI18nContractTest {
|
|
|
);
|
|
|
|
|
|
@Test
|
|
|
- void omgValidationKeysResolveInAllBundlesAndBoundaryIsSeparated() throws IOException {
|
|
|
+ void omgValidationKeysResolveInAllBundles() throws IOException {
|
|
|
for (Path bundle : allBundles()) {
|
|
|
Properties properties = loadProperties(bundle);
|
|
|
for (String key : OMG_KEYS) {
|
|
|
- assertNotNull(properties.getProperty(key),
|
|
|
+ String value = properties.getProperty(key);
|
|
|
+ assertNotNull(value,
|
|
|
() -> bundle.getFileName() + " should resolve " + key);
|
|
|
+ assertFalse(value.isBlank(),
|
|
|
+ () -> bundle.getFileName() + " should provide a non-blank value for " + key);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- for (Path bundle : malformedBoundaryBundles()) {
|
|
|
- String normalized = Files.readString(bundle, StandardCharsets.UTF_8).replace("\r\n", "\n");
|
|
|
- assertTrue(normalized.contains("\n\nomg.payment.ddid.required="),
|
|
|
- () -> bundle.getFileName() + " should start OMG keys on a separated block boundary");
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
private static Properties loadProperties(Path bundle) throws IOException {
|
|
|
@@ -59,14 +56,6 @@ class OmgPaymentAttemptI18nContractTest {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- private static List<Path> malformedBoundaryBundles() {
|
|
|
- return List.of(
|
|
|
- bundle("messages.properties"),
|
|
|
- bundle("messages_zh_CN.properties"),
|
|
|
- bundle("messages_zh_TW.properties")
|
|
|
- );
|
|
|
- }
|
|
|
-
|
|
|
private static Path bundle(String name) {
|
|
|
return Paths.get("..", "ruoyi-admin", "src", "main", "resources", "i18n", name);
|
|
|
}
|