Browse Source

Unittest Pong

main
fdai4616 2 years ago
parent
commit
b7f449ef5c
  1. 24
      src/test_/java/CollisionCheckerTest.java

24
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 { 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);
}
} }
Loading…
Cancel
Save