Ad
  • Custom User Avatar

    Sample tests is a joke: a null check isn't even a valid sample test. It doesn't check the basic requirement of the task of a kata.

    Also, what does null check add to the kata? Make it even more of a nuisance?

  • Custom User Avatar
  • Default User Avatar

    Let me add my 2 cents here:

    1. Tests should not reveal the solution. I'd suggest implement your own assertEquals method and use assertFalse with an appropriate message for element comparison.
    2. It's pretty easy to brute force the kata by passing a list of numbers instead of the working solution. Adding random tests could negate the problem, but the problem definition is too strict for this. So my suggestion is to redefine it as "find all VN with length N, where N is an input number > 0". This most probably will push kata difficulty level up to 6 kyu or so.
    3. I'd rephrase this part return all of them; (Means from 1K to 10K). by return all of them in ascending order.
    4. Add sample tests for small N = 1,2,3
    5. Swap expected and actual arguments at JUnit assertions. Actual is what returns from searchNumbers().
    6. Finally, I agree with @dinglemouse about the method structure. There is no need to pass ArrayList into. Also, I would use a List interface instead.
  • Custom User Avatar

    Thanks a lot dinglemouse! Now I understand. This is really useful experience for me! Can I ask you if I'll have some quiestions in programming?

  • Default User Avatar

    The method does not really need any input parameter to be able to meet the Kata requirement.

    So I was only suggesting it could've been something simpler like:

    public static List numbers() {
      final List<Integer> list = new ArrayList<>();
      // code ...
      return list;
    }
    
  • Custom User Avatar

    So you mean. I don't need to return the value, cause input value had been already changed in the body of the method and in fact I can operate with it without return. Right?
    I want to easily place method with return into input parameters of the other method.
    Tell me your opinion and make some suggestions to me please. Thanks!

  • Custom User Avatar

    Thanks for your note. I really mix up the example and main test cases.

  • Default User Avatar

    Don't understand the purpose of the method having both an input parameter and a return value. One or the other seems redundant.

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution