Skip to content

Conversation

@xinri
Copy link
Contributor

@xinri xinri commented Nov 16, 2025

pull request

Sync the largest-series-product. Missing reimplement (re-generated with configlet)

related to #2959


Reviewer Resources:

Track Policies

@xinri xinri marked this pull request as draft November 16, 2025 23:18
@xinri xinri marked this pull request as ready for review November 17, 2025 21:45
@xinri xinri force-pushed the sync_largest_series_product_tests branch from 772b252 to 33c41e2 Compare November 17, 2025 22:00
@xinri xinri changed the title sync the largest-series-product tests as they had been reimplemented but not sync sync the largest-series-product tests and fix / add missing unit tests Nov 17, 2025
@xinri xinri force-pushed the sync_largest_series_product_tests branch 2 times, most recently from 0465015 to bcfa8e6 Compare November 17, 2025 23:03
Copy link
Member

@jagdish-15 jagdish-15 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also check if there are any other tests that are marked as include = false but still exist in the test file. And please make all the error messages consistent with those in the canonical-data.json file. I’ve suggested changes for one of them, but I believe there are more cases like that, for example the rejects negative span test.


assertThatExceptionOfType(IllegalArgumentException.class)
.isThrownBy(() -> calculator.calculateLargestProductForSeriesLength(4))
.withMessage("Series length must be less than or equal to the length of the string to search.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.withMessage("span must not exceed string length");

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well it is indeed what the canonical said but I read that the implementation of the error messages should be made easy to read by the devs. I checked a lot of unit tests and their canonical file, and they have their own way to express what the canonical file raised as an error. So we should not just copy paste the error message but we should create an explicit message that will represent the error message in the canonical file no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, the message in the specification is not representing the error message.
I have replace it with "Series length must not exceed the length of the string to search." to match with the function.

By the way, if some mentee works on this exercise, they will have to rework again no ?

Copy link
Member

@kahgoh kahgoh Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to leave the exception messages as they were. I think your wording is saying the same thing as before, just with different wording.

By the way, if some mentee works on this exercise, they will have to rework again no ?

Yeah, if we change the wording, the students will need to update their solutions. Since the wording is saying the same thing, I don't think there is much benefit with changing the exception message (hence, my preference for leaving the exception message as is).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry I didn't see this answer. Thanks for the confirmation. I also prefer to keep the same error message because they are quite explicits

Comment on lines 130 to 150
@Disabled("Remove to run test")
@Test
@DisplayName("reports 1 for empty string and empty product (0 span)")
public void testEmptyStringToSearchAndSeriesOfNonZeroLengthIsRejected() {
public void testEmptyStringToSearchAndEmptyProduct() {
LargestSeriesProductCalculator calculator = new LargestSeriesProductCalculator("");

long actualProduct = calculator.calculateLargestProductForSeriesLength(0);

assertThat(actualProduct).isEqualTo(1);
}

@Disabled("Remove to run test")
@Test
@DisplayName("reports 1 for nonempty string and empty product (0 span)")
public void testNonEmptyStringToSearchAndEmptyProduct() {
LargestSeriesProductCalculator calculator = new LargestSeriesProductCalculator("123");

long actualProduct = calculator.calculateLargestProductForSeriesLength(0);

assertThat(actualProduct).isEqualTo(1);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the tests which are marked as include = false in the toml file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done thanks for checking that

@xinri xinri force-pushed the sync_largest_series_product_tests branch 3 times, most recently from 903baf0 to 34baef8 Compare November 18, 2025 18:32
@xinri xinri requested a review from jagdish-15 November 18, 2025 18:32
assertThatExceptionOfType(IllegalArgumentException.class)
.isThrownBy(() -> calculator.calculateLargestProductForSeriesLength(1))
.withMessage("Series length must be less than or equal to the length of the string to search.");
.withMessage("Series length must not exceed the length of the string to search.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned in another comment, let's keep the message as it was.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok I have done a rollback for this

assertThatExceptionOfType(IllegalArgumentException.class)
.isThrownBy(() -> calculator.calculateLargestProductForSeriesLength(-1))
.withMessage("Series length must be non-negative.");
.withMessage("Series length must not be negative.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned in another comment, let's keep the message as it was.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok I have done a rollback for this

@xinri xinri force-pushed the sync_largest_series_product_tests branch from 34baef8 to 989dcfa Compare November 18, 2025 23:18
@xinri xinri requested a review from kahgoh November 18, 2025 23:26
@jagdish-15 jagdish-15 added the x:rep/small Small amount of reputation label Nov 19, 2025
@jagdish-15 jagdish-15 merged commit 8419c95 into exercism:main Nov 19, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

x:rep/small Small amount of reputation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants