Pattern selector

Most relevant patterns first. Most helpful ones displayed. Click here to show all.

  1. Assert.assertEquals() has thrown an AssertionError
  2. JUnit test assertion failed

Your stack trace compared to the selected pattern

Jump to solutionsExpand frames
java.lang.AssertionError: The ListHolder should contain ITERATIONS entries expected:<50> but was:<51>
    at org.junit.Assert.failNotEquals(
    at org.junit.Assert.assertEquals(
1 frame hidden


chinthana10 months ago

AssertionError is thrown when using JUnit's internal assertions methods compare two different values and those are not equal. Also, the developer can invoke the method when the test logic fails.

The simplest code to reproduce the error is the following:

import static;

public class FailTest { 

   public void shouldAssertFail() { 
      if( ... ) {
         fail("Any message");

Mind the static import. The fail is part of the JUnit API.

Your best course of action is to use the debugger to see why the test is failing and what is the condition that is not being met.

External results for this pattern (10)

  1. cdjacksonvia GitHub1 day ago
    Show stack trace
  2. jenstroegervia GitHub1 day ago
    The warning results do not match expected:<[MessageId.PKG_012, MessageId.OPF_061, MessageId.OPF_003, MessageId.PKG_012]> but was:<[MessageId.OPF_003, MessageId.PKG_012, MessageId.OPF_061, MessageId.PKG_012]>
    Show stack trace
  3. BO41via GitHub1 day ago
    expected:<0> but was:<2>
    Show stack trace
  4. hhh0505via GitHub1 day ago
    expected:<Sun Jan 01 05:00:00 EST 2017> but was:<Sun Jan 01 10:00:00 EST 2017>
    Show stack trace
  5. ejona86via GitHub1 day ago
    Window was 131070 expecting 314570
    Show stack trace
  6. ejona86via GitHub1 day ago
    expected:<0> but was:<1>
    Show stack trace
  7. fenik17via GitHub1 day ago
    expected:<true> but was:<false>
    Show stack trace
  8. hidekivia GitHub1 day ago
    expected:<2> but was:<1>
    Show stack trace
  9. hidekivia GitHub1 day ago
    expected null, but was:<CouchbaseLiteException{domain=1, code=19, msg=null}>
    Show stack trace