Skip to main content
Code Review

Return to Revisions

2 of 2
replaced http://stackoverflow.com/ with https://stackoverflow.com/

Testing

  • concat isn't a great name for a test, it doesn't tell me anything about what it is that the test does, it simply copies the name of the method being called. Something like concatShouldReturnConcatenationForTwoPopulatedArrays might be a better description

  • Personally, for a test this simple, I'd tend to define the expected results for the test within it rather than calculating it on the fly. This makes it less likely that you'll get a failure because your test is wrong. It also allows you to use the junit array comparison.

     Assert.assertArrayEquals( expectedResult, result );
    
  • You've only got one test, I'd tend to add at least 3 more for:

     concat([], numbers2)
     concat(numbers1, [])
     concat([], [])
    
forsvarir
  • 11.8k
  • 7
  • 39
  • 72
default

AltStyle によって変換されたページ (->オリジナル) /