From ba9df4f3ee43b5370782f1e65f6f79a07882a886 Mon Sep 17 00:00:00 2001 From: zlnongi Date: Fri, 24 Mar 2023 17:21:28 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=EC=82=AC=EB=8B=A4=EB=A6=AC=EC=83=9D?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 1 + build/classes/java/main/ladder/Ladder.class | Bin 795 -> 848 bytes build/classes/java/main/ladder/Row.class | Bin 1353 -> 1391 bytes .../classes/java/test/ladder/LadderTest.class | Bin 1967 -> 2521 bytes build/classes/java/test/ladder/RowTest.class | Bin 4449 -> 0 bytes .../tests/test/classes/ladder.LadderTest.html | 134 +++++++++++++-- .../tests/test/classes/ladder.RowTest.html | 152 ------------------ build/reports/tests/test/index.html | 60 +++---- build/reports/tests/test/packages/ladder.html | 46 +++--- .../test/TEST-ladder.LadderTest.xml | 102 +++++++++++- .../test-results/test/TEST-ladder.RowTest.xml | 16 -- build/test-results/test/binary/results.bin | Bin 1021 -> 10300 bytes .../compileJava/previous-compilation-data.bin | Bin 144 -> 144 bytes .../previous-compilation-data.bin | Bin 925 -> 811 bytes src/main/java/ladder/Ladder.java | 30 +++- src/main/java/ladder/Row.java | 56 +++++++ src/test/java/ladder/LadderTest.java | 44 ++++- 17 files changed, 401 insertions(+), 240 deletions(-) delete mode 100644 build/classes/java/test/ladder/RowTest.class delete mode 100644 build/reports/tests/test/classes/ladder.RowTest.html delete mode 100644 build/test-results/test/TEST-ladder.RowTest.xml create mode 100644 src/main/java/ladder/Row.java diff --git a/build.gradle b/build.gradle index 3cae2d7..7e86750 100644 --- a/build.gradle +++ b/build.gradle @@ -11,6 +11,7 @@ repositories { dependencies { testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1' + testImplementation 'junit:junit:4.13.1' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1' } diff --git a/build/classes/java/main/ladder/Ladder.class b/build/classes/java/main/ladder/Ladder.class index d9ed44049aa6d0e3ca3fc6aa628c38846ef0a886..410273d82d6e73ebfa03aabdf51da9cc4484021d 100644 GIT binary patch literal 848 zcmYLG+int36kTTq3d{^pv08NoZ0ili3y~Ke)V`RQkWkwcQ)7G@VAQEN(+nU#&@btW zFUG_~+C*bNz(3JXXpD93f#S>F=d#Ya?DO;Qw_^YgaMyr=l^k+dm9mz>HR;z4q;NyZ zO)0lBsAf=8NX5~3ppbvn>U+JOAJ?~|@k0fj#|o;cPzXowJAS$sZv%=J&ooW_a(?E31Dc`+a?}KMy z5w3+i3Kohe5cxl+1rwG4Zd?+)prn&hSn#y3NM zyfrg|RgT)=KjLOTu-Ybq!folROsHMXi8~3|p3D?Dwg(M1)JkB?i5~ zd!73RQOoSIl2QG9>qeShIhQnXC6QFH;mpP|o>5oy$BwWcA7Dwk)36VbeX*}`0>A7}!6o&sh107%}P+E#IfW@i>7Ls)1LhZ)HgoN5gOcUd3fYDCHnPwQo2k2wC z>c)*56KxZXeE{D?AE7bU{|qCBq8d;ZWKAJ~B_-|?k#6;zk1@X)1u{-1d-V$feFRw3s_PJ1u+onYd7Y@;9A z!`Hj^aqN>C1@=skR1E#G=%y@7G`lUjr;h!J8@eLQ^!;ftbRN6Xk~zoRJ+j~0S(v!P z_y5ynkw!+Yx3VZpXre-LTrig^6hzz^+up0r-r&d?hGaLRMUc&XWIg9yxF7S;;D%FN zI@clY%yi}^vW(08dXFR$Je%!vsJ8VT+85~hPR%++x&0Y>?Hjb`)pI2JC%XD@_3KmQ zkYlW1i7`cWnr<1a(zU^Ji@tfjwE2?5bri5dCJF3dm8WEDyi-wDVy0o8c@f$b1qlO& zQhdC`HP)0Do$j(ud`xM}+OD13kI_=h{uIQdWOBMEv$D@H3Tao~0SN~qFHMi#0@R~cFQsW13-SiDow RplN8op{YxX6s0mk?JtmQearv= diff --git a/build/classes/java/main/ladder/Row.class b/build/classes/java/main/ladder/Row.class index 0b0180942da7b871dbf5c6166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0|_*Ow~SS5>L%sGzh3*T}bMlq0a zz3tRanR3_`EuR62qLr$JbKwosx2;mq7W*rrAW0Y56?U0nUORgF=;-?=l^>p0o_-Ur zeD&<;yC+9KKZ{o$Kd*fKW##cf;QQ%OymIhu<;TN#<<|pFYv}Xyo|O08z4bkJ-nH*r zeqN=L>Gj+_4d=$=$?^CYzZCy#M(TJlMiI6sZ05vJlj`H#4RN|B@s9+hRncM#53{lu zq`|;-+G}pv%gRMd6|S>Ul*>C}SC}x-uA#jp(aL#4!=PG_vW2sqO53*F7WSOCT`ow+ zuQO=qy5+il$@fHYS^9Z5SL%%7<1Vzbn=~3Bg%Q3lT-hJainQ;T_WRX%Xwn&_`H-IUdKdw zg!iLHzVJm^*d+sZOe`T|;(ZLZ)XZ{r-3OAlP#qx_M{J3#?|S>ZMTLfCV1+j>#E^Z%e*9`Uw>gzH z+IeByYrOtb239o;H|o?9R;wOf&9|>(venzF{&X;HXlL7@URU-S`^e}EXuog}LMPj3 z;A}$|$7Xc_PC`A$Ko2*Eg3Ug`bb1D&)4wD1x!(T*;bmjCTfcPnB_hBfqW2q^eac0| z5Rpv0ON3MC$9n8_UWRKVR=T@s*kEsOwNBTw}_3^A?49Eb1$ aK4TwaTGLp@r{w>TwmJfrxF(6qNd67}DC21W diff --git a/build/classes/java/test/ladder/RowTest.class b/build/classes/java/test/ladder/RowTest.class deleted file mode 100644 index d4fcd8ba3eb10a0f3b95f1a7fe8391b06c32401e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4449 zcmb`KZByJ-6vt24CtO0Ii&Bw3Z0S;#E$#A9S_?>}l*;M?6)0`BRl{z8KuBmd%Y)BV zJA>1XI#YFM9q>)Z&NzLcoleW(=m&88B(i=5$N$Y{lTa7BRA21P&E?$x`JIzWehGhxY^*Lp#XVl z$VcaVG{TX$LsBHYlOtES9=GmpH7Rmb7MB#UKRrDvYQw^)jFmuKO$hRcph@iBTy*Ob zQi`MUxGW@-q81%g=Z3|U-p(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VBob diff --git a/build/reports/tests/test/classes/ladder.LadderTest.html b/build/reports/tests/test/classes/ladder.LadderTest.html index cd3ab80..042fa84 100644 --- a/build/reports/tests/test/classes/ladder.LadderTest.html +++ b/build/reports/tests/test/classes/ladder.LadderTest.html @@ -23,13 +23,13 @@

LadderTest

-
2
+
3

tests

-
0
+
1

failures

@@ -41,7 +41,7 @@

LadderTest

-
0.007s
+
0.013s

duration

@@ -50,8 +50,8 @@

LadderTest

-
-
100%
+
+
66%

successful

@@ -61,30 +61,138 @@

LadderTest

+

Failed tests

+
+ +

testInvalidDrawLine()

+ +
org.opentest4j.AssertionFailedError: Unexpected exception type thrown ==> expected: <java.lang.IllegalArgumentException> but was: <java.lang.ArrayIndexOutOfBoundsException>
+	at app//org.junit.jupiter.api.AssertThrows.assertThrows(AssertThrows.java:65)
+	at app//org.junit.jupiter.api.AssertThrows.assertThrows(AssertThrows.java:37)
+	at app//org.junit.jupiter.api.Assertions.assertThrows(Assertions.java:3082)
+	at app//ladder.LadderTest.testInvalidDrawLine(LadderTest.java:32)
+	at java.base@11.0.18/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
+	at java.base@11.0.18/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
+	at java.base@11.0.18/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
+	at java.base@11.0.18/java.lang.reflect.Method.invoke(Method.java:566)
+	at app//org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:725)
+	at app//org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
+	at app//org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
+	at app//org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
+	at app//org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140)
+	at app//org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84)
+	at app//org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
+	at app//org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
+	at app//org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
+	at app//org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
+	at app//org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
+	at app//org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
+	at app//org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
+	at app//org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
+	at app//org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:214)
+	at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
+	at app//org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:210)
+	at app//org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:135)
+	at app//org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:66)
+	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)
+	at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
+	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
+	at app//org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
+	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
+	at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
+	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
+	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
+	at java.base@11.0.18/java.util.ArrayList.forEach(ArrayList.java:1541)
+	at app//org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
+	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
+	at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
+	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
+	at app//org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
+	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
+	at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
+	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
+	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
+	at java.base@11.0.18/java.util.ArrayList.forEach(ArrayList.java:1541)
+	at app//org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
+	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
+	at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
+	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
+	at app//org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
+	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
+	at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
+	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
+	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
+	at app//org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
+	at app//org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
+	at app//org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
+	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:108)
+	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
+	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)
+	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
+	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
+	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:96)
+	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:75)
+	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.processAllTestClasses(JUnitPlatformTestClassProcessor.java:99)
+	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.access$000(JUnitPlatformTestClassProcessor.java:79)
+	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.stop(JUnitPlatformTestClassProcessor.java:75)
+	at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:61)
+	at java.base@11.0.18/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
+	at java.base@11.0.18/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
+	at java.base@11.0.18/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
+	at java.base@11.0.18/java.lang.reflect.Method.invoke(Method.java:566)
+	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
+	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
+	at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
+	at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
+	at com.sun.proxy.$Proxy2.stop(Unknown Source)
+	at org.gradle.api.internal.tasks.testing.worker.TestWorker$3.run(TestWorker.java:193)
+	at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:129)
+	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:100)
+	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:60)
+	at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56)
+	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:133)
+	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:71)
+	at app//worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69)
+	at app//worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74)
+Caused by: java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 3
+	at ladder.Ladder.drawLine(Ladder.java:24)
+	at ladder.LadderTest.lambda$testInvalidDrawLine$0(LadderTest.java:32)
+	at org.junit.jupiter.api.AssertThrows.assertThrows(AssertThrows.java:55)
+	... 86 more
+
+
+
+
+

Tests

- - - + + + + + + - - - + +
TestMethod name Duration Result
만들어진 사다리 이상의 사람 예외 처리nthOfPersonValidate()testInvalidDrawLine()0.001sfailed
testInvalidRun() 0.001s passed
1 -1 0 0 / 0 1 -1 0 / 1 -1 0 0threeRowTwoColWithLine()0.006stestLadder()0.011s passed
@@ -97,7 +205,7 @@

Tests

Generated by -Gradle 7.4 at 2023. 3. 10. 오후 2:19:09

+Gradle 7.4 at 2023. 3. 24. 오후 5:13:29

diff --git a/build/reports/tests/test/classes/ladder.RowTest.html b/build/reports/tests/test/classes/ladder.RowTest.html deleted file mode 100644 index 3137820..0000000 --- a/build/reports/tests/test/classes/ladder.RowTest.html +++ /dev/null @@ -1,152 +0,0 @@ - - - - - -Test results - RowTest - - - - - -
-

RowTest

- -
- - - - - -
-
- - - - - - - -
-
-
10
-

tests

-
-
-
-
0
-

failures

-
-
-
-
0
-

ignored

-
-
-
-
0s
-

duration

-
-
-
-
-
-
100%
-

successful

-
-
-
-
- -
-

Tests

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TestMethod nameDurationResult
사다리 : 0OneColWithoutLine()0spassed
ValidateDrawLinePositionAlreadyHasLineLeft()ValidateDrawLinePositionAlreadyHasLineLeft()0spassed
ValidateDrawLinePositionAlreadyHasLineRight()ValidateDrawLinePositionAlreadyHasLineRight()0spassed
ValidateDrawLinePositionOverRange()ValidateDrawLinePositionOverRange()0spassed
ValidateDrawLinePositionUnderRange()ValidateDrawLinePositionUnderRange()0spassed
만들어진 사다리 이상의 사람 예외 처리nthOfPersonValidateOutOfRangeMAX()0spassed
1번째 이하의 사람 예외 처리nthOfPersonValidateOutOfRangeMIN()0spassed
사다리 : 110oneRowThreeColWithLine()0spassed
사다리 : 11twoColWithLine()0spassed
사다리 사람이 0명인 경우 예외처리validateNumberOfPerson()0spassed
-
-
- -
- - diff --git a/build/reports/tests/test/index.html b/build/reports/tests/test/index.html index d468623..77f6714 100644 --- a/build/reports/tests/test/index.html +++ b/build/reports/tests/test/index.html @@ -20,13 +20,13 @@

Test Summary

-
12
+
3

tests

-
0
+
1

failures

@@ -38,7 +38,7 @@

Test Summary

-
0.007s
+
0.013s

duration

@@ -47,8 +47,8 @@

Test Summary

-
-
100%
+
+
66%

successful

@@ -58,13 +58,25 @@

Test Summary

+

Failed tests

+ +
+

Packages

@@ -79,19 +91,19 @@

Packages

- - + + - - - + +
+ ladder 1231 000.007s100%0.013s66%
-
+

Classes

@@ -106,24 +118,14 @@

Classes

- - - - - - - - - - - + + - - + +
+ ladder.LadderTest 2000.007s100%
-ladder.RowTest -10031 00s100%0.013s66%
@@ -136,7 +138,7 @@

Classes

Generated by -Gradle 7.4 at 2023. 3. 10. 오후 2:19:09

+Gradle 7.4 at 2023. 3. 24. 오후 5:13:29

diff --git a/build/reports/tests/test/packages/ladder.html b/build/reports/tests/test/packages/ladder.html index da2ba46..53561a8 100644 --- a/build/reports/tests/test/packages/ladder.html +++ b/build/reports/tests/test/packages/ladder.html @@ -22,13 +22,13 @@

Package ladder

-
12
+
3

tests

-
0
+
1

failures

@@ -40,7 +40,7 @@

Package ladder

-
0.007s
+
0.013s

duration

@@ -49,8 +49,8 @@

Package ladder

-
-
100%
+
+
66%

successful

@@ -60,10 +60,22 @@

Package ladder

+

Failed tests

+ +
+

Classes

@@ -77,24 +89,14 @@

Classes

- - - - - - - - - - - + + - - + +
+ LadderTest 2000.007s100%
-RowTest -10031 00s100%0.013s66%
@@ -106,7 +108,7 @@

Classes

Generated by -Gradle 7.4 at 2023. 3. 10. 오후 2:19:09

+Gradle 7.4 at 2023. 3. 24. 오후 5:13:29

diff --git a/build/test-results/test/TEST-ladder.LadderTest.xml b/build/test-results/test/TEST-ladder.LadderTest.xml index 6e34e99..5853a57 100644 --- a/build/test-results/test/TEST-ladder.LadderTest.xml +++ b/build/test-results/test/TEST-ladder.LadderTest.xml @@ -1,8 +1,104 @@ - + - - + + + + org.opentest4j.AssertionFailedError: Unexpected exception type thrown ==> expected: <java.lang.IllegalArgumentException> but was: <java.lang.ArrayIndexOutOfBoundsException> + at app//org.junit.jupiter.api.AssertThrows.assertThrows(AssertThrows.java:65) + at app//org.junit.jupiter.api.AssertThrows.assertThrows(AssertThrows.java:37) + at app//org.junit.jupiter.api.Assertions.assertThrows(Assertions.java:3082) + at app//ladder.LadderTest.testInvalidDrawLine(LadderTest.java:32) + at java.base@11.0.18/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) + at java.base@11.0.18/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) + at java.base@11.0.18/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) + at java.base@11.0.18/java.lang.reflect.Method.invoke(Method.java:566) + at app//org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:725) + at app//org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60) + at app//org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131) + at app//org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149) + at app//org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140) + at app//org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84) + at app//org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115) + at app//org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105) + at app//org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106) + at app//org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64) + at app//org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45) + at app//org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37) + at app//org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104) + at app//org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98) + at app//org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:214) + at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) + at app//org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:210) + at app//org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:135) + at app//org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:66) + at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151) + at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) + at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141) + at app//org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137) + at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139) + at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) + at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138) + at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95) + at java.base@11.0.18/java.util.ArrayList.forEach(ArrayList.java:1541) + at app//org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41) + at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155) + at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) + at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141) + at app//org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137) + at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139) + at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) + at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138) + at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95) + at java.base@11.0.18/java.util.ArrayList.forEach(ArrayList.java:1541) + at app//org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41) + at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155) + at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) + at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141) + at app//org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137) + at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139) + at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) + at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138) + at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95) + at app//org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35) + at app//org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57) + at app//org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54) + at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:108) + at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88) + at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54) + at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67) + at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52) + at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:96) + at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:75) + at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.processAllTestClasses(JUnitPlatformTestClassProcessor.java:99) + at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.access$000(JUnitPlatformTestClassProcessor.java:79) + at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.stop(JUnitPlatformTestClassProcessor.java:75) + at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:61) + at java.base@11.0.18/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) + at java.base@11.0.18/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) + at java.base@11.0.18/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) + at java.base@11.0.18/java.lang.reflect.Method.invoke(Method.java:566) + at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36) + at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24) + at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33) + at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94) + at com.sun.proxy.$Proxy2.stop(Unknown Source) + at org.gradle.api.internal.tasks.testing.worker.TestWorker$3.run(TestWorker.java:193) + at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:129) + at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:100) + at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:60) + at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56) + at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:133) + at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:71) + at app//worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69) + at app//worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74) +Caused by: java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 3 + at ladder.Ladder.drawLine(Ladder.java:24) + at ladder.LadderTest.lambda$testInvalidDrawLine$0(LadderTest.java:32) + at org.junit.jupiter.api.AssertThrows.assertThrows(AssertThrows.java:55) + ... 86 more + + diff --git a/build/test-results/test/TEST-ladder.RowTest.xml b/build/test-results/test/TEST-ladder.RowTest.xml deleted file mode 100644 index a59387f..0000000 --- a/build/test-results/test/TEST-ladder.RowTest.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/build/test-results/test/binary/results.bin b/build/test-results/test/binary/results.bin index 365c81cfcc6da83e87c3b5a316e60f8605c1aef6..35ff7774334959b81a43c895ae2bbb35f6ef9d41 100644 GIT binary patch literal 10300 zcmeGi%W~sHFy7_D!ig`?!3X8QtR2U%6uX5<0vjs(s7!-*fD=b?wAkt`?PP!u_A)|%<*clY#6&*R3U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cwccoxu6*(4_$$uCnT(|_>7xnhc$3rFqF9-?3;hbYv9emuKdsYfqMA zlw#3wRo9(t!zdFhE+7zj^zRcHr(1KkxxDJ__WQ>uFlV|W+e=Hq>^B$gb~+d9sOW|0 z>lx@7>KWYKEY&ZsRR_314alaa+u8ZEJ7@Otn`^#SlO%@TC)<%5`n^u3^sbU RA$CDloIpV!mmQ>*0RSYova$dG diff --git a/src/main/java/ladder/Ladder.java b/src/main/java/ladder/Ladder.java index a9dc56b..19574f9 100644 --- a/src/main/java/ladder/Ladder.java +++ b/src/main/java/ladder/Ladder.java @@ -2,10 +2,32 @@ public class Ladder { - private final int[][] rows; + //private final int[][] rows; + private final Row[] rows; + private final int row; + private final int numberOfPerson; + // public Ladder(int row, int numberOfPerson) {rows = new int[row][numberOfPerson];} - public Ladder(int row, int numberOfPerson) { - rows = new int[row][numberOfPerson]; + public Ladder(int row, int numberOfPerson){ + this.row = row; + this.numberOfPerson = numberOfPerson; + rows = new Row[row]; + for(int i=0; i= 0 && startPosition < row.length) { + row[startPosition] = 1; + if (startPosition > 0) { + row[startPosition - 1] = -1; + } + } + } + + + public int newPosition(int position) { + validatePosition(position); + Random random = new Random(); + if (row[position] == 1) { // 오른쪽으로 움직임 + position++; + } else if (row[position] == -1) { // 왼쪽으로 움직임 + position--; + } else { // 움직임 없을 때 + } + return position; + } + + + private void validateNumberOfPerson(int numberOfPerson) { + if (numberOfPerson < 1) { + throw new IllegalArgumentException("사람 수가 너무 적습니다."); + } + } + + private void validateDrawLinePosition(int startPosition) { + if (startPosition < 0 || startPosition >= row.length - 1) { + throw new IllegalArgumentException("startPosition 값이 옳지 않습니다."); + } + } + + private void validatePosition(int position) { + if (position < 0 || position >= row.length) { + throw new IllegalArgumentException("Position 값이 유효하지 않습니다."); + } + } + +} \ No newline at end of file diff --git a/src/test/java/ladder/LadderTest.java b/src/test/java/ladder/LadderTest.java index 43b5df9..62199a8 100644 --- a/src/test/java/ladder/LadderTest.java +++ b/src/test/java/ladder/LadderTest.java @@ -1,6 +1,48 @@ package ladder; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + public class LadderTest { + @Test + public void testLadder() { + // Given + Ladder ladder = new Ladder(3, 5); + + // When + ladder.drawLine(0, 0); + ladder.drawLine(1, 1); + ladder.drawLine(2, 2); + + // Then + Assertions.assertEquals(0, ladder.run(0)); + Assertions.assertEquals(1, ladder.run(1)); + Assertions.assertEquals(2, ladder.run(2)); + Assertions.assertEquals(3, ladder.run(3)); + Assertions.assertEquals(4, ladder.run(4)); + } + + @Test + public void testInvalidDrawLine() { + // Given + Ladder ladder = new Ladder(3, 5); + + // When and Then + Assertions.assertThrows(IllegalArgumentException.class, () -> ladder.drawLine(-1, 0)); + Assertions.assertThrows(IllegalArgumentException.class, () -> ladder.drawLine(0, -1)); + Assertions.assertThrows(IllegalArgumentException.class, () -> ladder.drawLine(3, 0)); + Assertions.assertThrows(IllegalArgumentException.class, () -> ladder.drawLine(0, 5)); + } + + @Test + public void testInvalidRun() { + // Given + Ladder ladder = new Ladder(3, 5); + + // When and Then + Assertions.assertThrows(IllegalArgumentException.class, () -> ladder.run(-1)); + Assertions.assertThrows(IllegalArgumentException.class, () -> ladder.run(5)); + } -} \ No newline at end of file +} From 1a4602c44136681f6af1d086595eb989364b7ab0 Mon Sep 17 00:00:00 2001 From: zlnongi Date: Fri, 31 Mar 2023 19:21:32 +0900 Subject: [PATCH 2/2] =?UTF-8?q?server=202=EC=A3=BC=EC=B0=A8=20=EC=82=AC?= =?UTF-8?q?=EB=8B=A4=EB=A6=AC=ED=83=80=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/ladder/Ladder.java | 32 ++++++- src/main/java/ladder/LadderPosition.java | 19 +++++ src/main/java/ladder/Row.java | 15 ++++ src/test/java/ladder/LadderTest.java | 101 ++++++++++++++++------- src/test/java/ladder/RowTest.java | 30 +++++++ 5 files changed, 164 insertions(+), 33 deletions(-) create mode 100644 src/main/java/ladder/LadderPosition.java create mode 100644 src/test/java/ladder/RowTest.java diff --git a/src/main/java/ladder/Ladder.java b/src/main/java/ladder/Ladder.java index 19574f9..58aa12c 100644 --- a/src/main/java/ladder/Ladder.java +++ b/src/main/java/ladder/Ladder.java @@ -7,10 +7,14 @@ public class Ladder { private final int row; private final int numberOfPerson; // public Ladder(int row, int numberOfPerson) {rows = new int[row][numberOfPerson];} + private final int height; // 세로줄의 개수 + private final int width; // 가로줄의 개수 public Ladder(int row, int numberOfPerson){ this.row = row; this.numberOfPerson = numberOfPerson; + height = row; + width = numberOfPerson * 2 - 1; // 각 가로줄에는 세로줄이 2개씩 들어가므로, 사람 수에 2를 곱하고 1을 빼준다. rows = new Row[row]; for(int i=0; i 0 && rowString.charAt(currentPosition.getX() * 2 - 1) == '-') { // 현재 위치에서 왼쪽으로 가는 사다리가 있는 경우 + currentPosition = new LadderPosition(currentPosition.getX() - 1, currentPosition.getY() + 1); + } else if (currentPosition.getX() < width - 1 && rowString.charAt(currentPosition.getX() * 2 + 1) == '-') { // 현재 위치에서 오른쪽으로 가는 사다리가 있는 경우 + currentPosition = new LadderPosition(currentPosition.getX() + 1, currentPosition.getY() + 1); + } } - return position; + return currentPosition.getX(); } + + public void printLadder(int position) { + for (int i = 0; i < height; i++) { + String rowString = rows[i].getRowString(); + if (i == position) { // 현재 위치에 * 표시 + System.out.println(rowString.replaceAll("(\\\\|-)", "$0*")); + } else { + System.out.println(rowString); + } + } + } + } \ No newline at end of file diff --git a/src/main/java/ladder/LadderPosition.java b/src/main/java/ladder/LadderPosition.java new file mode 100644 index 0000000..0dc92ba --- /dev/null +++ b/src/main/java/ladder/LadderPosition.java @@ -0,0 +1,19 @@ +package ladder; + +public class LadderPosition { + private final int x; + private final int y; + + public LadderPosition(int x, int y) { + this.x = x; + this.y = y; + } + + public int getX() { + return x; + } + + public int getY() { + return y; + } +} diff --git a/src/main/java/ladder/Row.java b/src/main/java/ladder/Row.java index f04052d..f056c83 100644 --- a/src/main/java/ladder/Row.java +++ b/src/main/java/ladder/Row.java @@ -20,6 +20,19 @@ public void drawLine(int startPosition) { } } } + public String getRowString() { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < row.length; i++) { + if (row[i] == 1) { // if (row[i] != 0) 0 1 -1 + sb.append("-").append("\\"); // 현재 위치에서 오른쪽으로 가는 사다리 + } else if (row[i] == -1) { + sb.append("\\").append("-"); // 현재 위치에서 왼쪽으로 가는 사다리 + } else { + sb.append(" ").append(" "); // 사다리가 없는 경우 + } + } + return sb.toString(); + } public int newPosition(int position) { @@ -35,6 +48,8 @@ public int newPosition(int position) { } + + private void validateNumberOfPerson(int numberOfPerson) { if (numberOfPerson < 1) { throw new IllegalArgumentException("사람 수가 너무 적습니다."); diff --git a/src/test/java/ladder/LadderTest.java b/src/test/java/ladder/LadderTest.java index 62199a8..91039b0 100644 --- a/src/test/java/ladder/LadderTest.java +++ b/src/test/java/ladder/LadderTest.java @@ -6,43 +6,84 @@ public class LadderTest { @Test - public void testLadder() { - // Given - Ladder ladder = new Ladder(3, 5); - - // When - ladder.drawLine(0, 0); - ladder.drawLine(1, 1); - ladder.drawLine(2, 2); - - // Then - Assertions.assertEquals(0, ladder.run(0)); - Assertions.assertEquals(1, ladder.run(1)); - Assertions.assertEquals(2, ladder.run(2)); - Assertions.assertEquals(3, ladder.run(3)); - Assertions.assertEquals(4, ladder.run(4)); + public void testRowConstructor() { + Assertions.assertThrows(IllegalArgumentException.class, () -> new Row(0)); + Assertions.assertThrows(IllegalArgumentException.class, () -> new Row(-1)); + Assertions.assertDoesNotThrow(() -> new Row(1)); + Assertions.assertDoesNotThrow(() -> new Row(2)); + Assertions.assertDoesNotThrow(() -> new Row(1000)); } @Test - public void testInvalidDrawLine() { - // Given - Ladder ladder = new Ladder(3, 5); - - // When and Then - Assertions.assertThrows(IllegalArgumentException.class, () -> ladder.drawLine(-1, 0)); - Assertions.assertThrows(IllegalArgumentException.class, () -> ladder.drawLine(0, -1)); - Assertions.assertThrows(IllegalArgumentException.class, () -> ladder.drawLine(3, 0)); - Assertions.assertThrows(IllegalArgumentException.class, () -> ladder.drawLine(0, 5)); + public void testDrawLine() { + Row row = new Row(5); + Assertions.assertThrows(IllegalArgumentException.class, () -> row.drawLine(-1)); + Assertions.assertThrows(IllegalArgumentException.class, () -> row.drawLine(5)); + Assertions.assertDoesNotThrow(() -> row.drawLine(0)); + Assertions.assertDoesNotThrow(() -> row.drawLine(2)); } @Test - public void testInvalidRun() { - // Given - Ladder ladder = new Ladder(3, 5); + public void testNewPosition() { + Row row = new Row(5); + Row finalRow = row; + Assertions.assertThrows(IllegalArgumentException.class, () -> finalRow.newPosition(-1)); + Row finalRow1 = row; + Assertions.assertThrows(IllegalArgumentException.class, () -> finalRow1.newPosition(5)); - // When and Then - Assertions.assertThrows(IllegalArgumentException.class, () -> ladder.run(-1)); - Assertions.assertThrows(IllegalArgumentException.class, () -> ladder.run(5)); + // Test a row without any lines + int position = 0; + Assertions.assertEquals(position, row.newPosition(position)); + position = 1; + Assertions.assertEquals(position, row.newPosition(position)); + position = 2; + Assertions.assertEquals(position, row.newPosition(position)); + position = 3; + Assertions.assertEquals(position, row.newPosition(position)); + position = 4; + Assertions.assertEquals(position, row.newPosition(position)); + + // Test a row with a horizontal line at position 1 + row.drawLine(1); + position = 0; + Assertions.assertEquals(1, row.newPosition(position)); + position = 1; + Assertions.assertEquals(position, row.newPosition(position)); + position = 2; + Assertions.assertEquals(3, row.newPosition(position)); + position = 3; + Assertions.assertEquals(position, row.newPosition(position)); + position = 4; + Assertions.assertEquals(position, row.newPosition(position)); + + // Test a row with a horizontal line at position 3 + row = new Row(5); + row.drawLine(3); + position = 0; + Assertions.assertEquals(position, row.newPosition(position)); + position = 1; + Assertions.assertEquals(position, row.newPosition(position)); + position = 2; + Assertions.assertEquals(1, row.newPosition(position)); + position = 3; + Assertions.assertEquals(position, row.newPosition(position)); + position = 4; + Assertions.assertEquals(position, row.newPosition(position)); + + // Test a row with vertical lines + row = new Row(5); + row.drawLine(1); + row.drawLine(3); + position = 0; + Assertions.assertEquals(1, row.newPosition(position)); + position = 1; + Assertions.assertEquals(position, row.newPosition(position)); + position = 2; + Assertions.assertEquals(1, row.newPosition(position)); + position = 3; + Assertions.assertEquals(position, row.newPosition(position)); + position = 4; + Assertions.assertEquals(3, row.newPosition(position)); } } diff --git a/src/test/java/ladder/RowTest.java b/src/test/java/ladder/RowTest.java new file mode 100644 index 0000000..2f0534c --- /dev/null +++ b/src/test/java/ladder/RowTest.java @@ -0,0 +1,30 @@ +package ladder; + +import org.junit.Test; +import static org.junit.Assert.*; + +public class RowTest { + + @Test + public void testGetRowString() { + Row row = new Row(5); + row.drawLine(1); + row.drawLine(3); + assertEquals("|-|-|", row.getRowString()); + } + + @Test + public void testDrawLine() { + Row row = new Row(5); + row.drawLine(2); + assertEquals("|--| |", row.getRowString()); + } + + @Test + public void testNewPosition() { + Row row = new Row(5); + row.drawLine(1); + row.drawLine(3); + assertEquals(2, row.newPosition(2)); + } +}