Issue
Coming to Java from Python. I recognize this is pretty basic, but it doesn't seem this has been asked here yet and Google is being coy with me.
In Python, I'd simply do something like this but Java objects:
assertTrue(min <= mynum and mynum <= max);
Solution
I'd write:
assertTrue("mynum is out of range: " + mynum, min <= mynum && mynum <= max);
but technically you just need:
assertTrue(min <= mynum && mynum <= max);
Either way, be sure to write &&
and not and
.
Answered By - ruakh
Answer Checked By - David Marino (JavaFixing Volunteer)