Skip to content

Commit 16b0389

Browse files
committed
Updating test file to match with synced test.toml
1 parent c2b862d commit 16b0389

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

exercises/practice/two-bucket/.meta/config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
],
55
"contributors": [
66
"FridaTveit",
7+
"jagdish-15",
78
"jmrunkle",
89
"lemoncurry",
910
"mirkoperillo",

exercises/practice/two-bucket/src/test/java/TwoBucketTest.java

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
import static org.assertj.core.api.Assertions.assertThat;
55

6+
import java.util.Collections;
7+
68
public class TwoBucketTest {
79

810
@Test
@@ -75,4 +77,52 @@ public void testBucketOneSizeTwoBucketTwoSizeThreeStartWithOne() {
7577
assertThat(twoBucket.getOtherBucket()).isEqualTo(2);
7678

7779
}
80+
81+
@Disabled("Remove to run test")
82+
@Test
83+
public void testReachingGoalIsImpossible() {
84+
85+
TwoBucket twoBucket = new TwoBucket(6, 15, 5, "one");
86+
87+
assertThatExceptionOfType(IllegalArgumentException.class)
88+
.isThrownBy(() -> twoBucket.getTotalMoves()))
89+
.withMessage("impossible");
90+
assertThatExceptionOfType(IllegalArgumentException.class)
91+
.isThrownBy(() -> twoBucket.getFinalBucket()))
92+
.withMessage("impossible");
93+
assertThatExceptionOfType(IllegalArgumentException.class)
94+
.isThrownBy(() -> twoBucket.getOtherBucket()))
95+
.withMessage("impossible");
96+
97+
}
98+
99+
@Disabled("Remove to run test")
100+
@Test
101+
public void testBucketOneSizeSixBucketTwoSizeFifteenStartWithOne() {
102+
103+
TwoBucket twoBucket = new TwoBucket(6, 15, 9, "one");
104+
105+
assertThat(twoBucket.getTotalMoves()).isEqualTo(10);
106+
assertThat(twoBucket.getFinalBucket()).isEqualTo("two");
107+
assertThat(twoBucket.getOtherBucket()).isEqualTo(0);
108+
109+
}
110+
111+
@Disabled("Remove to run test")
112+
@Test
113+
public void testGoalLargerThanBothBucketsIsImpossible() {
114+
115+
TwoBucket twoBucket = new TwoBucket(5, 7, 8, "one");
116+
117+
assertThatExceptionOfType(IllegalArgumentException.class)
118+
.isThrownBy(() -> twoBucket.getTotalMoves()))
119+
.withMessage("impossible");
120+
assertThatExceptionOfType(IllegalArgumentException.class)
121+
.isThrownBy(() -> twoBucket.getFinalBucket()))
122+
.withMessage("impossible");
123+
assertThatExceptionOfType(IllegalArgumentException.class)
124+
.isThrownBy(() -> twoBucket.getOtherBucket()))
125+
.withMessage("impossible");
126+
127+
}
78128
}

0 commit comments

Comments
 (0)