-
-
Notifications
You must be signed in to change notification settings - Fork 687
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update tests two bucket #2877
base: main
Are you sure you want to change the base?
Update tests two bucket #2877
Conversation
I think with the error messages I think it is fine to leave them out of the exception. But, I think we should make our own exception instead of reusing |
@kahgoh, thank you for the suggestion—it does make a lot of sense to create a custom exception for this purpose. public class UnreachableGoalException extends RuntimeException {
public UnreachableGoalException() {
super();
}
public UnreachableGoalException(String message) {
super(message);
}
public UnreachableGoalException(String message, Throwable cause) {
super(message, cause);
}
} That said, when I think about this, we've used While your suggestion is undoubtedly a more "proper" and robust approach, it might feel a little inconsistent with the conventions used elsewhere. What are your thoughts on this? How do you think I should proceed? |
I think there is also precedence for making our own exceptions for our exercises, like BinarySearch and TreeBuilding. But yeah, the think the exception would look something like that. |
Sure, I'll get right on it as soon as possible, since I already have the body of the custom Exception ready. However, I'll implement it the way it's done in exercises like "Binary Search" and "Tree Building," instead of following the approach in "Calculator Conundrum," as that causes build failure issues for Windows users (as highlighted in the forum discussion). I was also considering implementing similar custom Exceptions in exercises like "Change," since an unassignable change value shouldn’t technically throw an |
Sounds good. Feel free to update "Calculator Conundrum" as well.
I'm reluctant to make this change in the other exercises. On one hand, I agree that there are other exercises where a custom exception makes sense. But on the other hand, wouldn't it mean solutions that students have already submitted become invalid if they use the custom exception? A lot of the community solutions would become invalid or outdated. The change would likely require the system to re-run tests on existing solutions, which incurs a cost (if you're interested, there is a note about expensive operations in Avoiding triggering unnecessary test runs). I'm not quite sure if the benefit is worth the cost from making the change. |
Great! I'll get to updating "Calculator Conundrum" and this exercise as soon as possible—sorry for the delay! Regarding the change to custom exceptions in other exercises, I completely agree with your point about the cost and the potential impact on existing solutions. Updating all exercises to use custom exceptions would indeed risk invalidating many community solutions, requiring a system-wide test rerun, which can be resource-intensive. For this particular exercise, however, the situation seems different. Since the tests have been updated from the problem-specification repository, community solutions for this exercise are already going to be invalidated. If updates from the problem-specification repo are frequent and similar changes would cause solutions to become outdated anyway, we could consider making this adjustment now. That said, it really comes down to the priority and whether the benefits of introducing custom exceptions outweigh the potential disruption. Let me know what you decide! |
Pull Request
This PR adds 3 new tests to the Two Bucket exercise to sync with the
problem-specifications
repository. Two of the newly added tests check for error handling, which was not tested before. I am also unsure about the error message—should I keep it as it is in theproblem-specifications
repo or modify it to be more informative?Let me know your thoughts on this.
Reviewer Resources:
Track Policies