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 {
|
public class AdminPermissionTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void shouldStartWithAuthMePrefix() {
|
public void shouldStartWithAuthMeAdminPrefix() {
|
||||||
// given
|
// given
|
||||||
String requiredPrefix = "authme.";
|
String requiredPrefix = "authme.admin.";
|
||||||
|
|
||||||
// when/then
|
// when/then
|
||||||
for (AdminPermission permission : AdminPermission.values()) {
|
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
|
@Test
|
||||||
public void shouldHaveUniqueNodes() {
|
public void shouldHaveUniqueNodes() {
|
||||||
// given
|
// given
|
||||||
|
@ -13,32 +13,13 @@ import static org.junit.Assert.fail;
|
|||||||
public class PlayerPermissionTest {
|
public class PlayerPermissionTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void shouldStartWithAuthMePrefix() {
|
public void shouldStartWithPlayerPrefix() {
|
||||||
// given
|
// given
|
||||||
String requiredPrefix = "authme.";
|
String playerBranch = "authme.player.";
|
||||||
|
|
||||||
// when/then
|
// when/then
|
||||||
for (PlayerPermission permission : PlayerPermission.values()) {
|
for (PlayerPermission permission : PlayerPermission.values()) {
|
||||||
if (!permission.getNode().startsWith(requiredPrefix)) {
|
if (!permission.getNode().startsWith(playerBranch)) {
|
||||||
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)) {
|
|
||||||
fail("The permission '" + permission + "' should use a node with the player-specific branch '"
|
fail("The permission '" + permission + "' should use a node with the player-specific branch '"
|
||||||
+ playerBranch + "'");
|
+ playerBranch + "'");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user