Pattern selector

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

  1. JUnit38ClassRunner.run() has thrown an AssertionFailedError
    JUnit
    2
    1
    1
  2. JUnit fail method
    JUnit
    94
    254
    97

Your stack trace compared to the selected pattern

Jump to solutionsExpand frames
junit.framework.AssertionFailedError: Class Test has no public
    at junit.framework.Assert.fail(Assert.java:57)
    at junit.framework.TestCase.fail(TestCase.java:227)
    at junit.framework.TestSuite$1.runTest(TestSuite.java:100)
    at junit.framework.TestCase.runBare(TestCase.java:141)
7 frames hidden

Solution

JaviRpo2 months ago

AssertionFailedError 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 org.junit.Assert.fail;

public class FailTest { 

   @Test 
   public void shouldAssertStrings() { 
      ...
      if( ... ) {
         fail("Any message");
      }
   } 
}

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

External results for this pattern (10)

  1. apupiervia GitHub9 hours ago
    expected:<0> but was:<1>
    Show stack trace
  2. johnjohndoevia GitHub6 days ago
    No message found for this stack trace.
    Show stack trace
  3. Dawid Loubservia Google Groups1 week ago
    expected:<1> but was:<0>
    Show stack trace
  4. Dawid Loubservia Google Groups1 week ago
    null
    Show stack trace
  5. El Deffovia Google Groups1 week ago
    null
    Show stack trace
  6. Maxime Gréauvia JIRA1 week ago
    Expected: <null> but was: file:/srv/ciagent/workspace/target/test-classes/repo/MyClass.groovy
    Show stack trace
  7. Franz Willervia JIRA1 week ago
    Created Document not found! uid:create.test.1.3
    Show stack trace
  8. shinsuke-matvia GitHub3 weeks ago
    Expecting IllegalArgumentException - non-bracketing
    Show stack trace
  9. No message found for this stack trace.
    Show stack trace
  10. aarthipavia GitHub1 month ago
    expected:<982007015> but was:<1232306490>
    Show stack trace