Example #1
0
 @Test(expected = IllegalStateException.class)
 public void cannotUpgradeLevel() {
   Level[] levels = Level.values();
   for (Level level : levels) {
     if (level.nextLevel() != null) continue;
     user.setLevel(level);
     user.upgradeLevel();
   }
 }
Example #2
0
 @Test
 public void upgradeLevel() {
   Level[] levels = Level.values();
   for (Level level : levels) {
     if (level.nextLevel() == null) continue;
     user.setLevel(level);
     user.upgradeLevel();
     assertThat(user.getLevel(), is(level.nextLevel()));
   }
 }
Example #3
0
 protected void upgradeLevel(User user) {
   user.upgradeLevel();
   userDao.update(user);
   sendUpgradeEMail(user);
 }