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 likeconcatShouldReturnConcatenationForTwoPopulatedArrays
might be a better descriptionPersonally, 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 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([], [])
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 likeconcatShouldReturnConcatenationForTwoPopulatedArrays
might be a better descriptionPersonally, 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([], [])
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 likeconcatShouldReturnConcatenationForTwoPopulatedArrays
might be a better descriptionPersonally, 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([], [])
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 likeconcatShouldReturnConcatenationForTwoPopulatedArrays
might be a better descriptionPersonally, 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([], [])