예제 #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();
   }
 }
예제 #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()));
   }
 }
예제 #3
0
 protected void upgradeLevel(User user) {
   user.upgradeLevel();
   userDao.update(user);
   sendUpgradeEMail(user);
 }