JUnit, assert multiple values

I have two posibilies for a defined int  to be true. How can i use something like this

int actual = getActualInt();

Assert.assertEquals(actual, 1); or  Assert.assertEquals(actual, 2);

Who is Participating?
ksivananthConnect With a Mentor Commented:
assertTrue - just check the value is true/false
assertEquals - compares two values for equalness
Assert.assertTrue( ( actual == 1 || actual == 2 ) );
mertezAuthor Commented:
is there any difference between assertTrue and assertEquals?

thank you
Gurvinder Pal SinghCommented:
assertTrue tells if the conditions are true

assertEquals tells if the parameters passed to the method are equal or not
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.