|
|
@ -2,6 +2,8 @@ import PingPong.CollisionChecker; |
|
|
|
import org.junit.jupiter.api.BeforeEach; |
|
|
|
import org.junit.jupiter.api.Test; |
|
|
|
|
|
|
|
import java.awt.*; |
|
|
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertFalse; |
|
|
|
import static org.junit.jupiter.api.Assertions.assertTrue; |
|
|
|
|
|
|
@ -48,4 +50,16 @@ public class CollisionCheckerTest { |
|
|
|
//assert |
|
|
|
assertFalse(result); |
|
|
|
} |
|
|
|
@Test |
|
|
|
void WhenBallRectangleIntersectsWithPaddleRectangle_didTouchPaddle_ReturnsTrue() { |
|
|
|
// arrange |
|
|
|
Rectangle ballRectangle = new Rectangle(1,1,1,1); |
|
|
|
Rectangle paddleRectangle = new Rectangle(1,1,5,5); |
|
|
|
|
|
|
|
//act |
|
|
|
Boolean result = collisionChecker.didTouchPaddle(ballRectangle, paddleRectangle); |
|
|
|
|
|
|
|
//assert |
|
|
|
assertTrue(result); |
|
|
|
} |
|
|
|
} |