From 56794efd3be7db992e2059d5ee61e373ddf2ed29 Mon Sep 17 00:00:00 2001 From: Friederike von Gruben Date: Mon, 6 Feb 2023 13:46:42 +0100 Subject: [PATCH] unittest: Edited test for QuizCommand This test tests the random function which gives a random number between 0 and a length back --- src/test/java/org/bitbiome/commands/QuizCommandTest.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/test/java/org/bitbiome/commands/QuizCommandTest.java b/src/test/java/org/bitbiome/commands/QuizCommandTest.java index 93afc23..520ae87 100644 --- a/src/test/java/org/bitbiome/commands/QuizCommandTest.java +++ b/src/test/java/org/bitbiome/commands/QuizCommandTest.java @@ -2,6 +2,8 @@ package org.bitbiome.commands; import org.junit.jupiter.api.Test; +import java.util.Random; + import static org.junit.jupiter.api.Assertions.*; public class QuizCommandTest { @@ -21,4 +23,10 @@ public class QuizCommandTest { long lastTimePlayed = System.currentTimeMillis(); assertTrue(QuizCommand.canPlayAgain(lastTimePlayed) < lastTimePlayed); } + + @Test + public void testRandomNumberGenerator() { + int getRandom = QuizCommand.random(3); + assertTrue(getRandom >= 0 && getRandom <= 3); + } }