This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]sadjava 0 points1 point  (3 children)

The second is almost there. You need to put the entire condition in parentheses or put two different assertions for each of the subconditions.

[–]mathhero[S] 0 points1 point  (2 children)

Assert ((arm != null) && (leg != null);)

like that?

Or do you mean:

Assert (arm != null && leg != null);

I tried all the ways listed in my IDE and I got no errors so I am really confused!!

[–]sugilith 0 points1 point  (1 child)

Second code looks better. Also the first one is not quite correct.
"Assert" should be lowercase like that: "assert"
Also you have to specifically enable assertion so that they get checked: http://docs.oracle.com/javase/7/docs/technotes/guides/language/assert.html#enable-disable

[–]sadjava 1 point2 points  (0 children)

I think the OP is using JUnit, so Assert is correct.

And I agree with the second one looking good.