diff --git a/exercises/practice/two-bucket/.meta/config.json b/exercises/practice/two-bucket/.meta/config.json index 4f45ff4a4..57c7007b7 100644 --- a/exercises/practice/two-bucket/.meta/config.json +++ b/exercises/practice/two-bucket/.meta/config.json @@ -14,7 +14,8 @@ "muzimuzhi", "sjwarner-bp", "SleeplessByte", - "sshine" + "sshine", + "Xinri" ], "files": { "solution": [ diff --git a/exercises/practice/two-bucket/.meta/tests.toml b/exercises/practice/two-bucket/.meta/tests.toml index d6ff02f53..a3fe533ec 100644 --- a/exercises/practice/two-bucket/.meta/tests.toml +++ b/exercises/practice/two-bucket/.meta/tests.toml @@ -27,6 +27,12 @@ description = "Measure one step using bucket one of size 1 and bucket two of siz [eb329c63-5540-4735-b30b-97f7f4df0f84] description = "Measure using bucket one of size 2 and bucket two of size 3 - start with bucket one and end with bucket two" +[58d70152-bf2b-46bb-ad54-be58ebe94c03] +description = "Measure using bucket one much bigger than bucket two" + +[9dbe6499-caa5-4a58-b5ce-c988d71b8981] +description = "Measure using bucket one much smaller than bucket two" + [449be72d-b10a-4f4b-a959-ca741e333b72] description = "Not possible to reach the goal" diff --git a/exercises/practice/two-bucket/src/test/java/TwoBucketTest.java b/exercises/practice/two-bucket/src/test/java/TwoBucketTest.java index 3564951ab..80d39f0ac 100644 --- a/exercises/practice/two-bucket/src/test/java/TwoBucketTest.java +++ b/exercises/practice/two-bucket/src/test/java/TwoBucketTest.java @@ -1,4 +1,5 @@ import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; @@ -7,6 +8,7 @@ public class TwoBucketTest { @Test + @DisplayName("Measure using bucket one of size 3 and bucket two of size 5 - start with bucket one") public void testBucketOneSizeThreeBucketTwoSizeFiveStartWithOne() { Result bucketResult = new TwoBucket(3, 5, 1, "one").getResult(); @@ -19,6 +21,7 @@ public void testBucketOneSizeThreeBucketTwoSizeFiveStartWithOne() { @Disabled("Remove to run test") @Test + @DisplayName("Measure using bucket one of size 3 and bucket two of size 5 - start with bucket two") public void testBucketOneSizeThreeBucketTwoSizeFiveStartWithTwo() { Result bucketResult = new TwoBucket(3, 5, 1, "two").getResult(); @@ -31,6 +34,7 @@ public void testBucketOneSizeThreeBucketTwoSizeFiveStartWithTwo() { @Disabled("Remove to run test") @Test + @DisplayName("Measure using bucket one of size 7 and bucket two of size 11 - start with bucket one") public void testBucketOneSizeSevenBucketTwoSizeElevenStartWithOne() { Result bucketResult = new TwoBucket(7, 11, 2, "one").getResult(); @@ -43,6 +47,7 @@ public void testBucketOneSizeSevenBucketTwoSizeElevenStartWithOne() { @Disabled("Remove to run test") @Test + @DisplayName("Measure using bucket one of size 7 and bucket two of size 11 - start with bucket two") public void testBucketOneSizeSevenBucketTwoSizeElevenStartWithTwo() { Result bucketResult = new TwoBucket(7, 11, 2, "two").getResult(); @@ -55,6 +60,7 @@ public void testBucketOneSizeSevenBucketTwoSizeElevenStartWithTwo() { @Disabled("Remove to run test") @Test + @DisplayName("Measure one step using bucket one of size 1 and bucket two of size 3 - start with bucket two") public void testBucketOneSizeOneBucketTwoSizeThreeStartWithTwo() { Result bucketResult = new TwoBucket(1, 3, 3, "two").getResult(); @@ -67,6 +73,10 @@ public void testBucketOneSizeOneBucketTwoSizeThreeStartWithTwo() { @Disabled("Remove to run test") @Test + @DisplayName( + "Measure using bucket one of size 2 and bucket two of size 3 - " + + "start with bucket one and end with bucket two" + ) public void testBucketOneSizeTwoBucketTwoSizeThreeStartWithOne() { Result bucketResult = new TwoBucket(2, 3, 3, "one").getResult(); @@ -79,8 +89,35 @@ public void testBucketOneSizeTwoBucketTwoSizeThreeStartWithOne() { @Disabled("Remove to run test") @Test + @DisplayName("Measure using bucket one much bigger than bucket two") + public void testBucketOneMuchBiggerThanBucketTwo() { + + Result bucketResult = new TwoBucket(5, 1, 2, "one").getResult(); + + assertThat(bucketResult.getTotalMoves()).isEqualTo(6); + assertThat(bucketResult.getFinalBucket()).isEqualTo("one"); + assertThat(bucketResult.getOtherBucket()).isEqualTo(1); + + } + + @Disabled("Remove to run test") + @Test + @DisplayName("Measure using bucket one much smaller than bucket two") + public void testBucketOneMuchSmallerThanBucketTwo() { + + Result bucketResult = new TwoBucket(3, 15, 9, "one").getResult(); + + assertThat(bucketResult.getTotalMoves()).isEqualTo(6); + assertThat(bucketResult.getFinalBucket()).isEqualTo("two"); + assertThat(bucketResult.getOtherBucket()).isEqualTo(0); + + } + + @Disabled("Remove to run test") + @Test + @DisplayName("Not possible to reach the goal") public void testReachingGoalIsImpossible() { - + assertThatExceptionOfType(UnreachableGoalException.class) .isThrownBy(() -> new TwoBucket(6, 15, 5, "one").getResult()); @@ -88,6 +125,7 @@ public void testReachingGoalIsImpossible() { @Disabled("Remove to run test") @Test + @DisplayName("With the same buckets but a different goal, then it is possible") public void testBucketOneSizeSixBucketTwoSizeFifteenStartWithOne() { Result bucketResult = new TwoBucket(6, 15, 9, "one").getResult(); @@ -96,10 +134,11 @@ public void testBucketOneSizeSixBucketTwoSizeFifteenStartWithOne() { assertThat(bucketResult.getFinalBucket()).isEqualTo("two"); assertThat(bucketResult.getOtherBucket()).isEqualTo(0); - } + } @Disabled("Remove to run test") @Test + @DisplayName("Goal larger than both buckets is impossible") public void testGoalLargerThanBothBucketsIsImpossible() { assertThatExceptionOfType(UnreachableGoalException.class)