From 8bd8ba01b141ec4c85eb8e9aa6bdfe91a8679694 Mon Sep 17 00:00:00 2001 From: fdai4616 Date: Wed, 8 Feb 2023 21:57:55 +0100 Subject: [PATCH] Unittest Pong --- src/test_/java/CollisionCheckerTest.java | 14 ++++++++++++++ .../BattleShip/BShip$IncomingGuessReader.class | Bin 0 -> 1718 bytes .../BattleShip/BShip$ShipsPlacedReader.class | Bin 0 -> 1142 bytes target/test-classes/AIGridGUITest.class | Bin 0 -> 1606 bytes target/test-classes/CollisionCheckerTest.class | Bin 0 -> 1403 bytes target/test-classes/ShipTest.class | Bin 0 -> 816 bytes target/test-classes/SnakeTest.class | Bin 0 -> 2071 bytes 7 files changed, 14 insertions(+) create mode 100644 target/classes/BattleShip/BShip$IncomingGuessReader.class create mode 100644 target/classes/BattleShip/BShip$ShipsPlacedReader.class create mode 100644 target/test-classes/AIGridGUITest.class create mode 100644 target/test-classes/CollisionCheckerTest.class create mode 100644 target/test-classes/ShipTest.class create mode 100644 target/test-classes/SnakeTest.class diff --git a/src/test_/java/CollisionCheckerTest.java b/src/test_/java/CollisionCheckerTest.java index 10da0f9..277d0e1 100644 --- a/src/test_/java/CollisionCheckerTest.java +++ b/src/test_/java/CollisionCheckerTest.java @@ -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); + } } diff --git a/target/classes/BattleShip/BShip$IncomingGuessReader.class b/target/classes/BattleShip/BShip$IncomingGu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}poT7V6Z~R5hNcb2D2y_M>U+)8xA}LOlt>S0=tW-@ zIL6Rd51h`_LoaE#j4KRnZfz(AwkFD4({LSO2HCXp+hVkf%>B^@G~5(($-BDYDY(TD zuHiD4#~r6s^mt)zFVBmfVOuJ0IE-&2if{qlSPq+&TrOWOs`(79k(e6h5%&Ycy(Sggs;>t;@O3=vm9%0eFuk%n50 zVoH$=oRY=RzU=Aw?W|t(YbYRn^wb!xY&!OCrK7rRmz+F*VTkssPjOfP8Cn*(>%FvH z(wLU9EbgRD-E}!J>1q%${fZJPmEk^EFetQ7e+P-;Haw*B5k*rJOJvn};s`AM3Ce+w zc}!fdl eg2}&-r4TWAMkoo-G40z9%#c;7jzpqPgZ&2$%K?Z0 literal 0 HcmV?d00001 diff --git a/target/test-classes/AIGridGUITest.class b/target/test-classes/AIGridGUITest.class new file mode 100644 index 0000000000000000000000000000000000000000..50abe400f8ff72bc7d3ff3debf8bbc84effcb23d GIT binary patch literal 1606 zcmbVLYi}Dx6g}fO@q-Vg0k4|JK7MR;szKVARW~#Mz23dinJvWX$d3db)R?9vJRrlbjoks?Fjq;AbY}K}F z?HuN@kU_zKiAw_Wlh7wJB5uxAL6v;4FfgcGNZgP0|)4=s24O}*`u7R@}_(AZquZ`CX zRJ1XtjgM9DIM&v84cwT7I`W6ac+0?sE?K_sxt*jKQI4@y12xo%;HfBvqOom&PL}jJp zsm_m;IN-O}^JL{X2-Wkzk6q6?(>3V0-jCO5QPwg( z)ph+$;CA(#e>4!ye_Lv8;@uCr)LC$pFTWX_9?9^Dd*snlbOLg>-B9WC*qDxw73)%P zre>lkupBe7M@gsmgRt#-s%!iGfgZz9Mgxxl* zeS|XMHIpK-5Bxl&f)t}iT4vtTvOm#sL=2tL%DL(}jkzJN?qteSN{R_vndMtY5m!0r z*Af+#(fzRsgMQsA&MrB09a3*`AN)7>^_|&^xNi{qCUI|(d*gp`e>vekVK%ze8&i1? zantNJUf}i+4JKcFpZgDA;qIIMkNQ!kk_PjRXel32iWv9F$;F1OJe1yR?VbTf7G`(Jy6U zfN0_e@Ix8r`U3GtG)-rBc4vO`o0*;a`Rm&c059=8h5&*JLMp--Vu&B{6P`D?+02(~ zN22a94871z-Fd|j%w($yA`HnL-E8hivMEW!&~06srIx6_7gh`kf-ww3RWPFB21Xgi zE+98eM>K`Spqy~S73D*QL}oLq{bf;zVhrO7CR9vfied6dYC*zu|bEC>F-P3!AA*ZDiP(t&oY=OF76Nl0w z@8qs)I(l1Fsn6uTZkp2JJsOLeKhsq30uN;4cc5b?e~mf z?wT~bM@9*heG}NC>hu$kTm4x7mP72VbgjC0t$XcB`gLH<8wq+AV>F%sqd(07$q?;n zP)Xh;El;a=7tWo5eW6VN_egrzKm-|*YS#c+3}4;Z=wn{6oHh^{!B&I+raE_Q3|3q>t_Z9Kwl~W|PS5I;C z9P=095|k1s)iB2C(=kQA8O$Ns37zW#^+Jc~CXf3Ra+qu%&@MpM5j?~r3fZUg*kgky v13D)?I_dc5|KO7%|1=e00STJR6qYXWN%!~+4fv=7J_%nw3{Qzu0MC8{x|Br) literal 0 HcmV?d00001 diff --git a/target/test-classes/ShipTest.class b/target/test-classes/ShipTest.class new file mode 100644 index 0000000000000000000000000000000000000000..2f2488427eda818c10f276932641b2477fc05521 GIT binary patch literal 816 zcmZuve^1j;6g`jq=+<>?OdJeRrl4+2sY>D>q9$NO7aK_2QX>Dojpukv*Ut9U?`2|y zNa6?ZLmBUDM@W=5x$QmgopaB<@BRMs^A~_u*fueTjDf6$9P$j+G5^YKkNYG0a4;4_ z#gKm~eW_kEWLj<4K!KsM$CdI#?^I509SSfR3VjhNotZFTX}K~(z14ND6niR^{%EJ| z>Ma!uRV)xsMjxc-iIb$jv56a4G;q^G9ZL+&ARO7_m<&*yN+m*@Po=#ZMIux(@FRv2 zPm+D^MS>yQI&Ql~(r;K;!7YZOA5RWHzn6-(vaXiDZQ%~q7_5}|_Df7uhFq)LO|9Lv za8Fw^hC%F8Nln_Ya9&MO3pF z#NklvOYNn6S#C?83z~R97eGHc(iH$hi~el-GL3AWfqhGs+Z6S(j++#%bOSngL>Xvg zc@oj&3uF_yqYD_H^0nd_N>1ko=Fd^fbiQNx9IKQzk7ii*8Z7reww|A1S9YGGOyx|J z=&g~V70hD|73!&qEkd^G;9g)6dvuxJVF?FVhKojGzn)s0*)PGtW8yICJZg=U& literal 0 HcmV?d00001 diff --git a/target/test-classes/SnakeTest.class b/target/test-classes/SnakeTest.class new file mode 100644 index 0000000000000000000000000000000000000000..1c96711727cdc4c4a6b6d95725c076325bc711d1 GIT binary patch literal 2071 zcmaJ?T~ixX7=BK&ArO|20)g^ji4;meAg#8x5{iWYZ8QZWfeKb-L)Lg`*x+WPgTKK$ zFTC+jSZ9E-GyVX_tMe zJ>uDLOUK)Ihtz07jatLe|5M5fy`$q@QSl`8HTg)PIDYF+^~=SxW=TD@Xb zhB(tX95+-~3N+_!nM=Et3+@yssje1it5t^~diFxUh8uP(Gw06xvG*dMqr)nv@kYUO z9(dLu@pW9+Bvb|@n zNTpu;nZz@yQ(1A+vP?TsP?k_ZZ~d%+Xxbwl8tS9*$72HmAMh^5Q7B~c1mY*&`0ydG zY8eP2#jEZ;fX7(nOkjaM82zUh zeu1&=!9aoE6O2#$k1=tI>2pxqRj_s$4!Cf@gPE^iW0Yd)cUjJ$mG^C&wUcEBI(c4& z(Zx5k2P3?@i(Yc>gNds+AgZdl?J=%Yp{$Y7IM2RLpqR>KoU zDjmGFkGZx@M5(mHQQ(uRCgLUYQ)1CmrwREV<0hrK?aEVAe6FD;HHu6<$K3|8+Aj6f z8b^C@MN!7jzAnCg@0zsd@%J0VH+0jDzR0~=_qlWX)E2l#9fzrFgwBo7r|THRC}(4I z?grh8(vJyhKZ&P2aLbs&cbLKVY}y}i6F=e>e&%8MJ3W1cJNSdA-=B>93-?4bW<>|$ zqMLu0%JoUlld9|DO4W5f>A4=k-xb%ZUVBKr*H5cn<1_O2Gy7$)ADm+8{9WpDU%5p- tnP9EU=;q<6I7PhJDkt`CwG*qHYJ1FwPZ{Imo}Y6JvFCbtR_{LO{}0(&wbK9q literal 0 HcmV?d00001