Browse Source

Unittest Pong

main
fdai4616 2 years ago
parent
commit
89fd6741ba
  1. 13
      src/test_/java/CollisionCheckerTest.java

13
src/test_/java/CollisionCheckerTest.java

@ -2,6 +2,7 @@ import PingPong.CollisionChecker;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
@ -35,4 +36,16 @@ public class CollisionCheckerTest {
//assert //assert
assertTrue(result); assertTrue(result);
} }
@Test
void WhenBallYCoordinateIsMoreThanZeroAndLessThanMaxHeight_didTouchTopOrBottomEdge_ReturnsFalse() {
// arrange
Integer ballYCoordinate = 75;
Integer maxHeight = 123;
// act
Boolean result = collisionChecker.didTouchTopOrBottomEdge(ballYCoordinate, maxHeight);
//assert
assertFalse(result);
}
} }
Loading…
Cancel
Save