Closed Jarak-Jakar closed 1 year ago
Hello. Thanks for opening an issue on Exercism. We are currently in a phase of our journey where we have paused community contributions to allow us to take a breather and redesign our community model. You can learn more in this blog post. As such, all issues and PRs in this repository are being automatically closed.
Note: If this issue has been pre-approved, please link back to this issue on the forum thread and a maintainer or staff member will reopen it.
The first task in the Elon's Toys exercise is to create a
buy()
method that instantiates a newRemoteControlCar
with full battery and 0 metres driven on it. There's nothing stated about writing any other constructor, however.The first three tests do indeed test that the
buy()
method behaves appropriately by creating a new car object with the method, but all subsequent tests just instantiate a new object by calling the default constructor directly, bypassing thebuy()
method. This causes anyone who hasn't overridden the implicit default constructor to fail most subsequent tests.An example of a solution to the problem which I believe is valid according to the instructions, but which fails, is my first iteration:
Basically, the issue here to me is that there's no instruction telling people to do anything to constructors, but rather it is implied that the
buy
method is the appropriate equivalent. After following the instructions, however, it turns out that this is not sufficient to make the tests pass. I suggest either changing the later tests to callRemoteControlCar.buy()
instead of using the constructor, or changing the instructions to state explicitly that people should override the default constructor.