exercism / java

Exercism exercises in Java.
https://exercism.org/tracks/java
MIT License
689 stars 671 forks source link

Collatz Conjecture: Test case should be added to check for more than one method call #2775

Closed Mauricio-MdS closed 5 months ago

Mauricio-MdS commented 5 months ago

A possible solution to this exercise would be to use recursion. However, a likely error in using recursion would be to place the steps as a field instead of a local variable of the method. This way, the steps would possibly not be reset on each new method call. There is no test case for this mistake.

manumafe98 commented 5 months ago

Hey @Mauricio-MdS thanks for opening an issue! This ones for me sounds more like an analyzer comment/suggestion to the student instead of an actual test case, @sanderploegsma I would like also your opinion on this one!

sanderploegsma commented 5 months ago

I'm not 100% sure I understand your concern @Mauricio-MdS without an example solution highlighting the problem you're describing. From what I gather though, I don't think the aim of this exercise (or most of the other exercises for that matter) is to care about details like these. The challenge is to correctly implement the Collatz Conjecture algorithm, quite probably by using recursion. All that matters is that the solution provides the correct answer given some input. I think that is adequately covered by the existing test cases.