use of ch.jalu.configme.resource.YamlFileReader in project AuthMeReloaded by AuthMe.
the class MessageUpdaterTest method shouldAddMissingKeys.
@Test
public void shouldAddMissingKeys() throws IOException {
// given
File messagesFile = temporaryFolder.newFile();
Files.copy(TestHelper.getJarFile(TestHelper.PROJECT_ROOT + "message/messages_test.yml"), messagesFile);
// when
boolean wasChanged = messageUpdater.migrateAndSave(messagesFile, "does-not-exist", DEFAULT_MESSAGES_FILE);
// then
assertThat(wasChanged, equalTo(true));
PropertyReader reader = new YamlFileReader(messagesFile);
// Existing keys should not be overridden
assertThat(reader.getString(MessageKey.LOGIN_SUCCESS.getKey()), equalTo("&cHere we have&bdefined some colors &dand some other <hings"));
assertThat(reader.getString(MessageKey.EMAIL_ALREADY_USED_ERROR.getKey()), equalTo(""));
// Check that new keys were added
assertThat(reader.getString(MessageKey.SECOND.getKey()), equalTo("second"));
assertThat(reader.getString(MessageKey.ERROR.getKey()), equalTo("&4An unexpected error occurred, please contact an administrator!"));
}
use of ch.jalu.configme.resource.YamlFileReader in project AuthMeReloaded by AuthMe.
the class HelpMessageConsistencyTest method shouldHaveRequiredEntries.
@Test
public void shouldHaveRequiredEntries() {
for (File file : helpFiles) {
// given
PropertyReader reader = new YamlFileReader(file);
// when / then
assertHasAllHelpSectionEntries(file.getName(), reader);
}
}
Aggregations