@@ -20,8 +20,7 @@ void testCutRodLength1() {
20
20
int [] prices = {1 }; // Price for piece of length 1
21
21
int length = 1 ;
22
22
int expectedValue = 1 ;
23
- assertEquals (expectedValue , RodCutting .cutRod (prices , length ),
24
- "The maximum obtainable value for a rod of length 1 should be 1." );
23
+ assertEquals (expectedValue , RodCutting .cutRod (prices , length ), "The maximum obtainable value for a rod of length 1 should be 1." );
25
24
}
26
25
27
26
/**
@@ -33,8 +32,7 @@ void testCutRodLength2() {
33
32
int [] prices = {1 , 5 }; // Prices for lengths 1 and 2
34
33
int length = 2 ;
35
34
int expectedValue = 5 ; // Best value is to cut it into a single piece of length 2
36
- assertEquals (expectedValue , RodCutting .cutRod (prices , length ),
37
- "The maximum obtainable value for a rod of length 2 should be 5." );
35
+ assertEquals (expectedValue , RodCutting .cutRod (prices , length ), "The maximum obtainable value for a rod of length 2 should be 5." );
38
36
}
39
37
40
38
/**
@@ -46,8 +44,7 @@ void testCutRodLength3() {
46
44
int [] prices = {1 , 5 , 8 }; // Prices for lengths 1, 2, and 3
47
45
int length = 3 ;
48
46
int expectedValue = 8 ; // Best value is to cut it into a single piece of length 3
49
- assertEquals (expectedValue , RodCutting .cutRod (prices , length ),
50
- "The maximum obtainable value for a rod of length 3 should be 8." );
47
+ assertEquals (expectedValue , RodCutting .cutRod (prices , length ), "The maximum obtainable value for a rod of length 3 should be 8." );
51
48
}
52
49
53
50
/**
@@ -59,8 +56,7 @@ void testCutRodLength4() {
59
56
int [] prices = {1 , 5 , 8 , 9 }; // Prices for lengths 1, 2, 3, and 4
60
57
int length = 4 ;
61
58
int expectedValue = 10 ; // Best value is to cut it into two pieces of length 2
62
- assertEquals (expectedValue , RodCutting .cutRod (prices , length ),
63
- "The maximum obtainable value for a rod of length 4 should be 10." );
59
+ assertEquals (expectedValue , RodCutting .cutRod (prices , length ), "The maximum obtainable value for a rod of length 4 should be 10." );
64
60
}
65
61
66
62
/**
@@ -72,8 +68,7 @@ void testCutRodLength5() {
72
68
int [] prices = {1 , 5 , 8 , 9 , 10 }; // Prices for lengths 1, 2, 3, 4, and 5
73
69
int length = 5 ;
74
70
int expectedValue = 13 ; // Best value is to cut it into pieces of lengths 2 and 3
75
- assertEquals (expectedValue , RodCutting .cutRod (prices , length ),
76
- "The maximum obtainable value for a rod of length 5 should be 13." );
71
+ assertEquals (expectedValue , RodCutting .cutRod (prices , length ), "The maximum obtainable value for a rod of length 5 should be 13." );
77
72
}
78
73
79
74
/**
@@ -85,8 +80,7 @@ void testCutRodLength0() {
85
80
int [] prices = {1 , 5 , 8 , 9 , 10 }; // Prices are irrelevant for length 0
86
81
int length = 0 ;
87
82
int expectedValue = 0 ; // No value obtainable from a rod of length 0
88
- assertEquals (expectedValue , RodCutting .cutRod (prices , length ),
89
- "The maximum obtainable value for a rod of length 0 should be 0." );
83
+ assertEquals (expectedValue , RodCutting .cutRod (prices , length ), "The maximum obtainable value for a rod of length 0 should be 0." );
90
84
}
91
85
92
86
/**
@@ -97,7 +91,6 @@ void testCutRodLength0() {
97
91
void testCutRodEmptyPrices () {
98
92
int [] prices = {};
99
93
int length = 5 ;
100
- assertThrows (IllegalArgumentException .class , () -> RodCutting .cutRod (prices , length ),
101
- "An empty prices array should throw an IllegalArgumentException." );
94
+ assertThrows (IllegalArgumentException .class , () -> RodCutting .cutRod (prices , length ), "An empty prices array should throw an IllegalArgumentException." );
102
95
}
103
96
}
0 commit comments