Skip to content

Commit 903baf0

Browse files
committed
reimplement and fix unit tests in the largest series product feature
Signed-off-by: xinri <[email protected]>
1 parent 2a74ff4 commit 903baf0

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

exercises/practice/largest-series-product/.meta/config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"Smarticles101",
2323
"sonapraneeth-a",
2424
"sshine",
25+
"Xinri",
2526
"Zaldrick"
2627
],
2728
"files": {

exercises/practice/largest-series-product/src/test/java/LargestSeriesProductCalculatorTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,18 +124,18 @@ public void testSeriesLengthLongerThanLengthOfStringToTestIsRejected() {
124124

125125
assertThatExceptionOfType(IllegalArgumentException.class)
126126
.isThrownBy(() -> calculator.calculateLargestProductForSeriesLength(4))
127-
.withMessage("Series length must be less than or equal to the length of the string to search.");
127+
.withMessage("Series length must not exceed the length of the string to search.");
128128
}
129129

130130
@Disabled("Remove to run test")
131131
@Test
132-
@DisplayName("reports 1 for empty string and empty product (0 span)")
133-
public void testEmptyStringToSearchAndSeriesOfNonZeroLengthIsRejected() {
132+
@DisplayName("rejects empty string and nonzero span")
133+
public void testEmptyStringAndNonZeroSpanIsRejected() {
134134
LargestSeriesProductCalculator calculator = new LargestSeriesProductCalculator("");
135135

136136
assertThatExceptionOfType(IllegalArgumentException.class)
137137
.isThrownBy(() -> calculator.calculateLargestProductForSeriesLength(1))
138-
.withMessage("Series length must be less than or equal to the length of the string to search.");
138+
.withMessage("Series length must not exceed the length of the string to search.");
139139
}
140140

141141
@Disabled("Remove to run test")
@@ -155,7 +155,7 @@ public void testNegativeSeriesLengthIsRejected() {
155155

156156
assertThatExceptionOfType(IllegalArgumentException.class)
157157
.isThrownBy(() -> calculator.calculateLargestProductForSeriesLength(-1))
158-
.withMessage("Series length must be non-negative.");
158+
.withMessage("Series length must not be negative.");
159159
}
160160

161161
@Disabled("Remove to run test")

0 commit comments

Comments
 (0)