Pattern selector

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

  1. JUnit string comparisson failed

Your stack trace compared to the selected pattern

Jump to solutionsExpand frames
org.junit.ComparisonFailure: expected:<[1]> but was:<[0]>
    at org.junit.Assert.assertEquals(
    at org.junit.Assert.assertEquals(


igorski3 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. expected:<.[ContactsListActivity]> but was:<.[ApiDemos]>
    Show stack trace
  2. hasancelikvia GitHub2 days ago
    expected:<[LatestUpdatedV]alue2> but was:<[v]alue2>
    Show stack trace
  3. zonghaishangvia GitHub1 week 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
  4. Jared Martinvia Google Groups1 week ago
    expected:<[hello world!]> but was:<[Mock for Foo, hashCode: 936146014]>
    Show stack trace
  5. handycccvia GitHub2 weeks ago
    expected:<[Futur]e-day Pickup> but was:<[Sam]e-day Pickup>
    Show stack trace
  6. mcomellavia GitHub3 weeks ago
    expected:<a网络A[]> but was:<a网络A[.网络]>
    Show stack trace
  7. ruckcvia GitHub1 month ago
    expected:<[authenticationFailure]> but was:<[error]>
    Show stack trace
  8. vmassolvia GitHub1 month 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
  9. nanojovervia GitHub1 month ago
    expected:<Elegir Servicio[]> but was:<Elegir Servicio[1]> --
    Show stack trace
  10. seenureddyvia GitHub1 month ago
    expected:<[06d1165a-9352-489f-b537-132a229e725d]> but was:<[93f13344-a0b4-476c-acde-80d87e7e4737]>
    Show stack trace