Fix unit testing

whoops
This commit is contained in:
Gabriele C 2018-04-19 12:09:07 +02:00
parent 6e16abc34e
commit d533f8e19c

View File

@ -216,18 +216,16 @@ public class PurgeTaskTest {
private void setPermissionsBehavior() { private void setPermissionsBehavior() {
given(permissionsManager.hasPermissionOffline(any(OfflinePlayer.class), eq(BYPASS_NODE))) given(permissionsManager.hasPermissionOffline(any(OfflinePlayer.class), eq(BYPASS_NODE)))
.willAnswer(new Answer<Boolean>() { .willAnswer((Answer<Boolean>) invocationOnMock -> {
@Override OfflinePlayer player = invocationOnMock.getArgument(0);
public Boolean answer(InvocationOnMock invocationOnMock) throws Throwable { Boolean hasPermission = playerBypassAssignments.get(player);
OfflinePlayer player = invocationOnMock.getArgument(0); if (hasPermission == null) {
Boolean hasPermission = playerBypassAssignments.get(player); throw new IllegalStateException("Unexpected check of '" + BYPASS_NODE
if (hasPermission == null) { + "' with player = " + player);
throw new IllegalStateException("Unexpected check of '" + BYPASS_NODE
+ "' with player = " + player);
}
return hasPermission;
} }
return hasPermission;
}); });
given(permissionsManager.loadUserData(any(OfflinePlayer.class))).willReturn(true);
} }
private void assertRanPurgeWithPlayers(OfflinePlayer... players) { private void assertRanPurgeWithPlayers(OfflinePlayer... players) {