Browse Source

unittest: Added test for testRunawaySucceeds()

remotes/origin/fight-engine
fdai7430 2 years ago
parent
commit
c392ee6c26
  1. 10
      src/test/java/org/bitbiome/commands/UseCommandTest.java

10
src/test/java/org/bitbiome/commands/UseCommandTest.java

@ -1,6 +1,7 @@
package org.bitbiome.commands; package org.bitbiome.commands;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList; import java.util.ArrayList;
@ -35,6 +36,15 @@ public class UseCommandTest {
assertEquals(100, com.getRunawayChance()); assertEquals(100, com.getRunawayChance());
} }
@Test
public void testRunawaySucceeds() {
UseCommand com = new UseCommand();
assertEquals(true, com.runawaySucceeds(0));
assertEquals(false, com.runawaySucceeds(101));
int random = (int)(Math.random()*100);
assertTrue(com.runawaySucceeds(random) || !com.runawaySucceeds(random));
}
@Test @Test
public void testUseItemMob() { public void testUseItemMob() {
UseCommand com = new UseCommand(); UseCommand com = new UseCommand();

Loading…
Cancel
Save