Pattern selector

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

  1. JUnit string comparisson failed
    JUnit
    29
    340
    18

Your stack trace compared to the selected pattern

Jump to solutionsExpand frames
org.junit.ComparisonFailure: expected:<[DRACARYS! ]> but was:<[]>
    at org.junit.Assert.assertEquals(Assert.java:115)
    at org.junit.Assert.assertEquals(Assert.java:144)

Solution

igorski4 months ago

ComparisonFailure is thrown when using JUnit's internal assertions to compare two strings that are not equal. The simplest code to reproduce the error is the following:

import static org.junit.Assert.assertEquals;

public class StringComparisonTest { @Test public void shouldAssertStrings() { assertEquals("1", "2"); } }

Mind the static import. The assertEquals is part of the JUnit API and not a third party assertion library like AssertJ.

External results for this pattern (10)

  1. codingphilvia GitHub1 month ago
    expected:<[1]> but was:<[0]>
    Show stack trace
  2. TikhomirovSergeyvia GitHub1 month ago
    expected:<.[ContactsListActivity]> but was:<.[ApiDemos]>
    Show stack trace
  3. hasancelikvia GitHub1 month ago
    expected:<[LatestUpdatedV]alue2> but was:<[v]alue2>
    Show stack trace
  4. zonghaishangvia GitHub1 month ago
    expected:<... exceeds size limit:[100]> but was:<... exceeds size limit:[ 100, try to specify -M size_limit in your command, check the help command for more.]>
    Show stack trace
  5. Jared Martinvia Google Groups1 month ago
    expected:<[hello world!]> but was:<[Mock for Foo, hashCode: 936146014]>
    Show stack trace
  6. handycccvia GitHub1 month ago
    expected:<[Futur]e-day Pickup> but was:<[Sam]e-day Pickup>
    Show stack trace
  7. mcomellavia GitHub1 month ago
    expected:<a网络A[]> but was:<a网络A[.网络]>
    Show stack trace
  8. ruckcvia GitHub2 months ago
    expected:<[authenticationFailure]> but was:<[error]>
    Show stack trace
  9. vmassolvia GitHub2 months ago
    expected:<...s org.xwiki.context.[ExecutionContextPropertyTest$SomeSubClass], but was [class org.xwiki.context.]ExecutionContextProp...> but was:<...s org.xwiki.context.[AmplExecutionContextPropertyTest$SomeSubClass], but was [class org.xwiki.context.Ampl]ExecutionContextProp...>
    Show stack trace
  10. nanojovervia GitHub2 months ago
    expected:<Elegir Servicio[]> but was:<Elegir Servicio[1]> --
    Show stack trace