Browse Source

unittest: Edited test for QuizCommand

This test tests the random function which gives a random number between 0 and a length back
remotes/origin/quiz
Friederike von Gruben 2 years ago
parent
commit
56794efd3b
  1. 8
      src/test/java/org/bitbiome/commands/QuizCommandTest.java

8
src/test/java/org/bitbiome/commands/QuizCommandTest.java

@ -2,6 +2,8 @@ package org.bitbiome.commands;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import java.util.Random;
import static org.junit.jupiter.api.Assertions.*; import static org.junit.jupiter.api.Assertions.*;
public class QuizCommandTest { public class QuizCommandTest {
@ -21,4 +23,10 @@ public class QuizCommandTest {
long lastTimePlayed = System.currentTimeMillis(); long lastTimePlayed = System.currentTimeMillis();
assertTrue(QuizCommand.canPlayAgain(lastTimePlayed) < lastTimePlayed); assertTrue(QuizCommand.canPlayAgain(lastTimePlayed) < lastTimePlayed);
} }
@Test
public void testRandomNumberGenerator() {
int getRandom = QuizCommand.random(3);
assertTrue(getRandom >= 0 && getRandom <= 3);
}
} }
Loading…
Cancel
Save