java.lang.AssertionError: expected:<2> but was:<1>

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

,
Expert tip

Check your pattern declaration or check your assert declaration.

,

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.

Solutions on the web

via GitHub by hasancelik
, 1 year ago
expected:<2> but was:<1>
via GitHub by hasancelik
, 8 months ago
expected:<2> but was:<1>
via GitHub by hasancelik
, 1 year ago
expected:<2> but was:<1>
via GitHub by hasancelik
, 1 year ago
expected:<2> but was:<1>
via GitHub by hasancelik
, 10 months ago
expected:<2> but was:<1>
via GitHub by anuraaga
, 8 months ago
expected:<3> but was:<2>
java.lang.AssertionError: expected:<2> but was:<1>
at org.junit.Assert.fail(Assert.java:88)
at org.junit.Assert.failNotEquals(Assert.java:834)
at org.junit.Assert.assertEquals(Assert.java:645)
at org.junit.Assert.assertEquals(Assert.java:631)
at com.hazelcast.cardinality.CardinalityEstimatorAdvancedTest.testCardinalityEstimatorSpawnNodeInParallel(CardinalityEstimatorAdvancedTest.java:111)

Users with the same issue

8 times, 4 days ago
Once, 4 days ago
53 times, 5 days ago
Once, 1 week ago
Once, 1 week ago

Write tip

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