/**
* Tests for onAlterActionHP.
*/
@Test
public final void testOnAlterActionHP() {
final AdministrationAction aa = new AlterAction();
final Player pl = PlayerTestHelper.createPlayer("bob");
pl.setAdminLevel(5000);
pl.setBaseHP(100);
pl.setHP(100);
MockStendhalRPRuleProcessor.get().addPlayer(pl);
final RPAction action = new RPAction();
action.put("type", "alter");
action.put("target", "bob");
action.put("stat", "hp");
action.put("mode", "");
action.put("value", 0);
assertEquals(100, pl.getHP());
aa.onAction(pl, action);
assertEquals("may not change HP to 0 ", 100, pl.getHP());
action.put("value", 120);
aa.onAction(pl, action);
assertEquals("may not change HP over base_hp", 100, pl.getHP());
action.put("value", 90);
aa.onAction(pl, action);
assertEquals("may change HP to 90 ", 90, pl.getHP());
action.put("value", 90);
action.put("mode", "sub");
assertEquals("may change HP to 90 ", 90, pl.getHP());