java.lang.AssertionError: expected:<149> but was:<21>

Searched on Google with the first line of a JAVA stack trace?

We can recommend more relevant solutions and speed up debugging when you paste your entire stack trace with the exception message. Try a sample exception.

Recommended solutions based on your search

Samebug tips


My guess is there is some kind of static state in the code being tested or in the test itself, so the tests aren't isolated. Adding the test changes the test order. In any case, your best course of action is to use the debugger to see why the tests fail.


Check your assert declaration and the method implementation with the condition.

Solutions on the web

via GitHub by WolfgangPutz
, 1 year ago
expected:<149> but was:<21>
via Stack Overflow by fergjo
, 2 years ago
via Stack Overflow by nizar ouerghi
, 2 years ago
L'appel du : http://<server>/MyResful/dao/test à renvoyé : your value is null
via GitHub by bilalyasar
, 1 year ago
expected:<0> but was:<2>
via by Unknown author, 1 year ago
java.lang.AssertionError: expected:&lt;149&gt; but was:&lt;21&gt;

Users with the same issue

Once, 2 days ago
Once, 3 days ago
Once, 6 days ago
Once, 1 week ago
2 times, 2 weeks ago

Write tip

Know the solutions? Share your knowledge to help other developers to debug faster.