mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-19 15:17:56 +01:00
Merge prefix tests for AdminPermission and PlayerPermission
This commit is contained in:
parent
bfebf6dc44
commit
3de7a7584e
@ -13,9 +13,9 @@ import static org.junit.Assert.fail;
|
||||
public class AdminPermissionTest {
|
||||
|
||||
@Test
|
||||
public void shouldStartWithAuthMePrefix() {
|
||||
public void shouldStartWithAuthMeAdminPrefix() {
|
||||
// given
|
||||
String requiredPrefix = "authme.";
|
||||
String requiredPrefix = "authme.admin.";
|
||||
|
||||
// when/then
|
||||
for (AdminPermission permission : AdminPermission.values()) {
|
||||
@ -26,20 +26,6 @@ public class AdminPermissionTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldContainAdminBranch() {
|
||||
// given
|
||||
String requiredBranch = ".admin.";
|
||||
|
||||
// when/then
|
||||
for (AdminPermission permission : AdminPermission.values()) {
|
||||
if (!permission.getNode().contains(requiredBranch)) {
|
||||
fail("The permission '" + permission + "' does not contain with the required branch '"
|
||||
+ requiredBranch + "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldHaveUniqueNodes() {
|
||||
// given
|
||||
|
@ -13,32 +13,13 @@ import static org.junit.Assert.fail;
|
||||
public class PlayerPermissionTest {
|
||||
|
||||
@Test
|
||||
public void shouldStartWithAuthMePrefix() {
|
||||
public void shouldStartWithPlayerPrefix() {
|
||||
// given
|
||||
String requiredPrefix = "authme.";
|
||||
String playerBranch = "authme.player.";
|
||||
|
||||
// when/then
|
||||
for (PlayerPermission permission : PlayerPermission.values()) {
|
||||
if (!permission.getNode().startsWith(requiredPrefix)) {
|
||||
fail("The permission '" + permission + "' does not start with the required prefix '" + requiredPrefix
|
||||
+ "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldContainPlayerBranch() {
|
||||
// given
|
||||
String playerBranch = ".player.";
|
||||
String adminBranch = ".admin.";
|
||||
|
||||
// when/then
|
||||
for (PlayerPermission permission : PlayerPermission.values()) {
|
||||
if (permission.getNode().contains(adminBranch)) {
|
||||
fail("The permission '" + permission + "' should not use a node with the admin-specific branch '"
|
||||
+ adminBranch + "'");
|
||||
|
||||
} else if (!permission.getNode().contains(playerBranch)) {
|
||||
if (!permission.getNode().startsWith(playerBranch)) {
|
||||
fail("The permission '" + permission + "' should use a node with the player-specific branch '"
|
||||
+ playerBranch + "'");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user