11import org .junit .jupiter .api .Disabled ;
2+ import org .junit .jupiter .api .DisplayName ;
23import org .junit .jupiter .api .Test ;
34
45import static org .assertj .core .api .Assertions .assertThat ;
78public class TwoBucketTest {
89
910 @ Test
11+ @ DisplayName ("Measure using bucket one of size 3 and bucket two of size 5 - start with bucket one" )
1012 public void testBucketOneSizeThreeBucketTwoSizeFiveStartWithOne () {
1113
1214 Result bucketResult = new TwoBucket (3 , 5 , 1 , "one" ).getResult ();
@@ -19,6 +21,7 @@ public void testBucketOneSizeThreeBucketTwoSizeFiveStartWithOne() {
1921
2022 @ Disabled ("Remove to run test" )
2123 @ Test
24+ @ DisplayName ("Measure using bucket one of size 3 and bucket two of size 5 - start with bucket two" )
2225 public void testBucketOneSizeThreeBucketTwoSizeFiveStartWithTwo () {
2326
2427 Result bucketResult = new TwoBucket (3 , 5 , 1 , "two" ).getResult ();
@@ -31,6 +34,7 @@ public void testBucketOneSizeThreeBucketTwoSizeFiveStartWithTwo() {
3134
3235 @ Disabled ("Remove to run test" )
3336 @ Test
37+ @ DisplayName ("Measure using bucket one of size 7 and bucket two of size 11 - start with bucket one" )
3438 public void testBucketOneSizeSevenBucketTwoSizeElevenStartWithOne () {
3539
3640 Result bucketResult = new TwoBucket (7 , 11 , 2 , "one" ).getResult ();
@@ -43,6 +47,7 @@ public void testBucketOneSizeSevenBucketTwoSizeElevenStartWithOne() {
4347
4448 @ Disabled ("Remove to run test" )
4549 @ Test
50+ @ DisplayName ("Measure using bucket one of size 7 and bucket two of size 11 - start with bucket two" )
4651 public void testBucketOneSizeSevenBucketTwoSizeElevenStartWithTwo () {
4752
4853 Result bucketResult = new TwoBucket (7 , 11 , 2 , "two" ).getResult ();
@@ -55,6 +60,7 @@ public void testBucketOneSizeSevenBucketTwoSizeElevenStartWithTwo() {
5560
5661 @ Disabled ("Remove to run test" )
5762 @ Test
63+ @ DisplayName ("Measure one step using bucket one of size 1 and bucket two of size 3 - start with bucket two" )
5864 public void testBucketOneSizeOneBucketTwoSizeThreeStartWithTwo () {
5965
6066 Result bucketResult = new TwoBucket (1 , 3 , 3 , "two" ).getResult ();
@@ -67,6 +73,7 @@ public void testBucketOneSizeOneBucketTwoSizeThreeStartWithTwo() {
6773
6874 @ Disabled ("Remove to run test" )
6975 @ Test
76+ @ DisplayName ("Measure using bucket one of size 2 and bucket two of size 3 - " + "start with bucket one and end with bucket two" )
7077 public void testBucketOneSizeTwoBucketTwoSizeThreeStartWithOne () {
7178
7279 Result bucketResult = new TwoBucket (2 , 3 , 3 , "one" ).getResult ();
@@ -79,15 +86,42 @@ public void testBucketOneSizeTwoBucketTwoSizeThreeStartWithOne() {
7986
8087 @ Disabled ("Remove to run test" )
8188 @ Test
89+ @ DisplayName ("Measure using bucket one much bigger than bucket two" )
90+ public void testBucketOneMuchBiggerThanBucketTwo () {
91+
92+ Result bucketResult = new TwoBucket (5 , 1 , 2 , "one" ).getResult ();
93+
94+ assertThat (bucketResult .getTotalMoves ()).isEqualTo (6 );
95+ assertThat (bucketResult .getFinalBucket ()).isEqualTo ("one" );
96+ assertThat (bucketResult .getOtherBucket ()).isEqualTo (1 );
97+
98+ }
99+
100+ @ Disabled ("Remove to run test" )
101+ @ Test
102+ @ DisplayName ("Measure using bucket one much smaller than bucket two" )
103+ public void testBucketOneMuchSmallerThanBucketTwo () {
104+
105+ Result bucketResult = new TwoBucket (3 , 15 , 9 , "one" ).getResult ();
106+
107+ assertThat (bucketResult .getTotalMoves ()).isEqualTo (6 );
108+ assertThat (bucketResult .getFinalBucket ()).isEqualTo ("two" );
109+ assertThat (bucketResult .getOtherBucket ()).isEqualTo (0 );
110+
111+ }
112+
113+ @ Disabled ("Remove to run test" )
114+ @ Test
115+ @ DisplayName ("Not possible to reach the goal" )
82116 public void testReachingGoalIsImpossible () {
83-
84- assertThatExceptionOfType (UnreachableGoalException .class )
85- .isThrownBy (() -> new TwoBucket (6 , 15 , 5 , "one" ).getResult ());
117+
118+ assertThatExceptionOfType (UnreachableGoalException .class ).isThrownBy (() -> new TwoBucket (6 , 15 , 5 , "one" ).getResult ());
86119
87120 }
88121
89122 @ Disabled ("Remove to run test" )
90123 @ Test
124+ @ DisplayName ("With the same buckets but a different goal, then it is possible" )
91125 public void testBucketOneSizeSixBucketTwoSizeFifteenStartWithOne () {
92126
93127 Result bucketResult = new TwoBucket (6 , 15 , 9 , "one" ).getResult ();
@@ -96,14 +130,14 @@ public void testBucketOneSizeSixBucketTwoSizeFifteenStartWithOne() {
96130 assertThat (bucketResult .getFinalBucket ()).isEqualTo ("two" );
97131 assertThat (bucketResult .getOtherBucket ()).isEqualTo (0 );
98132
99- }
133+ }
100134
101135 @ Disabled ("Remove to run test" )
102136 @ Test
137+ @ DisplayName ("Goal larger than both buckets is impossible" )
103138 public void testGoalLargerThanBothBucketsIsImpossible () {
104139
105- assertThatExceptionOfType (UnreachableGoalException .class )
106- .isThrownBy (() -> new TwoBucket (5 , 7 , 8 , "one" ).getResult ());
140+ assertThatExceptionOfType (UnreachableGoalException .class ).isThrownBy (() -> new TwoBucket (5 , 7 , 8 , "one" ).getResult ());
107141
108142 }
109143}
0 commit comments