1

I've written a method that returns an int[]. I want to create a test that ensures that when I run my method, passing, say, 10 to the method, that it returns an int[]{0,1,3,5,7}.

How can I do this? Maybe I'm just missing the proper syntax or should be using a different assert method...?

LuxuryMode
  • 33,401
  • 34
  • 117
  • 188

1 Answers1

2

If you are using JUnit4, you could use the org.junit.Assert class:

Assert.assertArrayEquals(new int[]{0,1,3,5,7}, someMethod(10));
Tommy Siu
  • 1,265
  • 2
  • 10
  • 24