#1467 Change message keys and messages_en to new structure

This commit is contained in:
ljacqu
2018-01-29 20:56:30 +01:00
parent dfe47066cd
commit f714e9d564
4 changed files with 257 additions and 197 deletions
@@ -3,9 +3,12 @@ package fr.xephi.authme.message;
import fr.xephi.authme.util.StringUtils;
import org.junit.Test;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import static org.hamcrest.Matchers.matchesPattern;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
/**
@@ -29,4 +32,18 @@ public class MessageKeyTest {
}
}
}
@Test
public void shouldHaveWellFormedPlaceholders() {
// given
MessageKey[] messageKeys = MessageKey.values();
// when / then
for (MessageKey messageKey : messageKeys) {
String[] tags = messageKey.getTags();
Arrays.stream(tags)
.forEach(tag -> assertThat("Tag '" + tag + "' corresponds to valid format for key '" + messageKey + "'",
tag, matchesPattern("^%[a-z_]+$")));
}
}
}