File tree Expand file tree Collapse file tree 2 files changed +26
-2
lines changed
exercises/practice/largest-series-product Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change 2222 " Smarticles101" ,
2323 " sonapraneeth-a" ,
2424 " sshine" ,
25- " Zaldrick"
25+ " Zaldrick" ,
26+ " Xinri"
2627 ],
2728 "files" : {
2829 "solution" : [
Original file line number Diff line number Diff line change @@ -130,12 +130,35 @@ public void testSeriesLengthLongerThanLengthOfStringToTestIsRejected() {
130130 @ Disabled ("Remove to run test" )
131131 @ Test
132132 @ DisplayName ("reports 1 for empty string and empty product (0 span)" )
133- public void testEmptyStringToSearchAndSeriesOfNonZeroLengthIsRejected () {
133+ public void testEmptyStringToSearchAndEmptyProduct () {
134+ LargestSeriesProductCalculator calculator = new LargestSeriesProductCalculator ("" );
135+
136+ long actualProduct = calculator .calculateLargestProductForSeriesLength (0 );
137+
138+ assertThat (actualProduct ).isEqualTo (1 );
139+ }
140+
141+ @ Disabled ("Remove to run test" )
142+ @ Test
143+ @ DisplayName ("reports 1 for nonempty string and empty product (0 span)" )
144+ public void testNonEmptyStringToSearchAndEmptyProduct () {
145+ LargestSeriesProductCalculator calculator = new LargestSeriesProductCalculator ("123" );
146+
147+ long actualProduct = calculator .calculateLargestProductForSeriesLength (0 );
148+
149+ assertThat (actualProduct ).isEqualTo (1 );
150+ }
151+
152+ @ Disabled ("Remove to run test" )
153+ @ Test
154+ @ DisplayName ("rejects empty string and nonzero span" )
155+ public void testEmptyStringAndNonZeroSpanIsRejected () {
134156 LargestSeriesProductCalculator calculator = new LargestSeriesProductCalculator ("" );
135157
136158 assertThatExceptionOfType (IllegalArgumentException .class )
137159 .isThrownBy (() -> calculator .calculateLargestProductForSeriesLength (1 ))
138160 .withMessage ("Series length must be less than or equal to the length of the string to search." );
161+
139162 }
140163
141164 @ Disabled ("Remove to run test" )
You can’t perform that action at this time.
0 commit comments