From b7f449ef5c2d3bd7ff649d744db9a8c855f7fad2 Mon Sep 17 00:00:00 2001 From: fdai4616 Date: Wed, 8 Feb 2023 21:54:06 +0100 Subject: [PATCH] Unittest Pong --- src/test_/java/CollisionCheckerTest.java | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/test_/java/CollisionCheckerTest.java b/src/test_/java/CollisionCheckerTest.java index 78b955d..f262ff7 100644 --- a/src/test_/java/CollisionCheckerTest.java +++ b/src/test_/java/CollisionCheckerTest.java @@ -1,2 +1,26 @@ +import PingPong.CollisionChecker; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertTrue; + + public class CollisionCheckerTest { + CollisionChecker collisionChecker; + @BeforeEach + public void before() { + CollisionChecker collisionChecker = new CollisionChecker(); + } + @Test + void WhenBallYCoordinateIsLessOrEqualThanZero_didTouchTopOrBottomEdge_ReturnsTrue() { + // arrange + Integer ballYCoordinate = -1; + Integer maxHeight = 123; + + // act + Boolean result = collisionChecker.didTouchTopOrBottomEdge(ballYCoordinate, maxHeight); + + //assert + assertTrue(result); + } }