use of com.tvd12.ezyfoxserver.wrapper.EzySimpleUserManager in project ezyfox-server by youngmonkeys.
the class EzySimpleUserManagerTest method fromConstructorTest.
@Test
public void fromConstructorTest() {
EzySimpleUserManager manager = new EzySimpleUserManager(1);
assert manager.getMaxUsers() == 1;
assert manager.available();
EzySimpleUser user1 = new EzySimpleUser();
user1.setName("user1");
manager.addUser(user1);
try {
EzySimpleUser user2 = new EzySimpleUser();
user2.setName("user2");
manager.addUser(user2);
} catch (Exception e) {
assert e instanceof EzyMaxUserException;
}
assert !manager.available();
manager.getLock(user1.getName());
manager.clear();
manager.destroy();
}
use of com.tvd12.ezyfoxserver.wrapper.EzySimpleUserManager in project ezyfox-server by youngmonkeys.
the class EzySimpleUserManagerTest method fromBuilderTest.
@Test
public void fromBuilderTest() {
int maxUsers = RandomUtil.randomSmallInt() + 3;
EzySimpleUserManager manager = (EzySimpleUserManager) EzySimpleUserManager.builder().maxUsers(maxUsers).build();
assert manager.getMaxUsers() == maxUsers;
assert manager.available();
EzySimpleUser user1 = new EzySimpleUser();
user1.setName("user1");
manager.addUser(user1);
try {
EzySimpleUser user2 = new EzySimpleUser();
user2.setName("user2");
manager.addUser(user2);
} catch (Exception e) {
assert e instanceof EzyMaxUserException;
}
assert manager.available();
manager.getLock(user1.getName());
manager.clear();
manager.destroy();
}
Aggregations