|
@ -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); |
|
|
|
|
|
} |
|
|
} |
|
|
} |