ContinuousDamageTest.java 文件源码

java
阅读 37 收藏 0 点赞 0 评论 0

项目:kata-botwars 作者:
@Test
@DisplayName("that destroys its target will have that bot removed from its team before it can attack")
void botDestroyedFromContinuousDamageWillBeRemovedBeforeItsAttack(@Mock UserInterface ui) {
    Effect continuousDamage = createEffectFactoryFor(aBot().withPower(9999).build(),
            1, ContinuousDamage.class).newInstance();
    Bot bot = aBot().withIntegrity(1).withStatusEffects(continuousDamage).withPower(100).withSpeed(1000).build();
    Bot target = aBot().withIntegrity(100).build();

    when(ui.selectTarget(eq(bot), anyListOf(Bot.class))).thenReturn(Optional.of(target));

    Game game = new Game(ui, aPlayer().withTeam(bot, anyBot(), anyBot()).build(),
            aPlayer().withTeam(target, anyBot(), anyBot()).build());

    game.turn();

    assertEquals(100, target.getIntegrity(),
            "Bot should have been destroyed by Continuous Damage before is had a chance to attack");

}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号