From c386934979c7875e0a766fa64b7ecb2f63229097 Mon Sep 17 00:00:00 2001 From: xinri Date: Sun, 16 Nov 2025 23:52:46 +0100 Subject: [PATCH 1/3] sync the two-bucket tests as they had been implemented but not sync --- exercises/practice/two-bucket/.meta/tests.toml | 6 ++++++ 1 file changed, 6 insertions(+) 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" From f7ddd1cfe9eb73c48fc4c5d82ae87d3e60feb664 Mon Sep 17 00:00:00 2001 From: xinri Date: Mon, 17 Nov 2025 01:01:24 +0100 Subject: [PATCH 2/3] mplements two missing unit tests --- .../practice/two-bucket/.meta/config.json | 3 +- .../src/test/java/TwoBucketTest.java | 42 ++++++++++++++++++- 2 files changed, 42 insertions(+), 3 deletions(-) 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/src/test/java/TwoBucketTest.java b/exercises/practice/two-bucket/src/test/java/TwoBucketTest.java index 3564951ab..e5a58dcea 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,9 @@ 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 +88,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 +124,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 +133,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) From 8f9f22a713f2ea58433cd66c80f38f46ba3d1be0 Mon Sep 17 00:00:00 2001 From: Xinri <40863690+xinri@users.noreply.github.com> Date: Tue, 18 Nov 2025 11:34:01 +0100 Subject: [PATCH 3/3] Update exercises/practice/two-bucket/src/test/java/TwoBucketTest.java Co-authored-by: Jagdish Prajapati --- .../practice/two-bucket/src/test/java/TwoBucketTest.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/exercises/practice/two-bucket/src/test/java/TwoBucketTest.java b/exercises/practice/two-bucket/src/test/java/TwoBucketTest.java index e5a58dcea..80d39f0ac 100644 --- a/exercises/practice/two-bucket/src/test/java/TwoBucketTest.java +++ b/exercises/practice/two-bucket/src/test/java/TwoBucketTest.java @@ -74,8 +74,9 @@ 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") + "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();