First options menu and a lot of fixes

This commit is contained in:
2020-07-19 20:02:54 +02:00
parent 6521ceeec7
commit 201fac09cc
16 changed files with 289 additions and 78 deletions

View File

@@ -35,18 +35,21 @@ public class ContentTests {
@Test
public void areLangsUpToDate() throws IOException {
Properties properties = new Properties();
InputStream inputStream = contentManager.getResource("lang/en_us.lang").orElseThrow().getInputStream();
InputStream inputStream = contentManager.getResource("lang/en_us.properties").orElseThrow().getInputStream();
properties.load(inputStream);
Assertions.assertAll(contentManager.getResources("lang", "lang").flatMap(resource -> {
if (resource.getId().equals("lang/en_us.lang")) {
if (resource.getId().equals("lang/en_us.properties")) {
return Stream.empty();
}
Properties props = new Properties();
return Stream.of(() -> {
Assertions.assertDoesNotThrow(() -> props.load(resource.getInputStream()));
Assertions.assertAll(properties.keySet().stream().map(key -> () ->
Assertions.assertTrue(props.containsKey(key), "Missing lang key " + key + " for file " + resource.getId())
Assertions.assertAll(properties.keySet().stream().map(key -> () -> {
if (!key.toString().startsWith("langs.")) {
Assertions.assertTrue(props.containsKey(key), "Missing lang key " + key + " for file " + resource.getId());
}
}
));
});
}));
@@ -67,8 +70,8 @@ public class ContentTests {
String productKey = "products." + productType.getId();
Stream<Executable> stream = Arrays.stream(productType.getProperties()).map(property -> () ->
Assertions.assertTrue(
i18n.containsKey(productKey + "." + property),
() -> "Missing translation for property " + property + "@" + productType.getId() + ": " + productKey + "." + property
i18n.containsKey(productKey + "." + property),
() -> "Missing translation for property " + property + "@" + productType.getId() + ": " + productKey + "." + property
)
);
stream = Stream.concat(stream, Stream.of(() -> Assertions.assertTrue(i18n.containsKey(productKey), "Missing translation for product name: " + productKey)));