Browse Source

Unittest Pong

main
fdai4616 2 years ago
parent
commit
8bd8ba01b1
  1. 14
      src/test_/java/CollisionCheckerTest.java
  2. BIN
      target/classes/BattleShip/BShip$IncomingGuessReader.class
  3. BIN
      target/classes/BattleShip/BShip$ShipsPlacedReader.class
  4. BIN
      target/test-classes/AIGridGUITest.class
  5. BIN
      target/test-classes/CollisionCheckerTest.class
  6. BIN
      target/test-classes/ShipTest.class
  7. BIN
      target/test-classes/SnakeTest.class

14
src/test_/java/CollisionCheckerTest.java

@ -2,6 +2,8 @@ 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 java.awt.*;
import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
@ -48,4 +50,16 @@ public class CollisionCheckerTest {
//assert //assert
assertFalse(result); 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);
}
} }

BIN
target/classes/BattleShip/BShip$IncomingGuessReader.class

BIN
target/classes/BattleShip/BShip$ShipsPlacedReader.class

BIN
target/test-classes/AIGridGUITest.class

BIN
target/test-classes/CollisionCheckerTest.class

BIN
target/test-classes/ShipTest.class

BIN
target/test-classes/SnakeTest.class

Loading…
Cancel
Save