java.lang.AssertionError: Expected: is "Administrator <root@localhost>" but: was ""

JIRA | Damian Jansen | 2 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    Version-Release number of selected component (if applicable): 3.4 Description of problem: Rest test intermittent failure in jenkins. == Regression org.zanata.rest.service.TranslationResourceRestTest.headersAfterTranslating (from TestSuite) Failing for the past 1 build (Since #1838 ) Took 0.19 sec. Error Message Expected: is "Administrator <root@localhost>" but: was "" Stacktrace java.lang.AssertionError: Expected: is "Administrator <root@localhost>" but: was "" at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20) at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:8) at org.zanata.rest.service.TranslationResourceRestTest.headersAfterTranslating(TranslationResourceRestTest.java:914) == Also, this test contains asserting for-loops which are not appropriate in tests, for safety and readability. In this particular case if the collection is empty, or the headers don't match, the test will pass which is incorrect. There are several instances of the same code behaviour in the above class, which should be altered to something like for (HeaderEntry entry : header.getEntries()) { somehashmap.put(entry.getKey(), entry.getValue.trim()) } assertThat(somehashmap.get(HeaderFields.KEY_LastTranslator), is("Administrator <root@localhost>")); assertThat(somehashmap.get(HeaderFields.KEY_PoRevisionDate).length(), greaterThan(0)); The behaviour of the above cannot otherwise be properly verified.

    JIRA | 2 years ago | Damian Jansen
    java.lang.AssertionError: Expected: is "Administrator <root@localhost>" but: was ""
  2. 0

    Version-Release number of selected component (if applicable): 3.4 Description of problem: Rest test intermittent failure in jenkins. == Regression org.zanata.rest.service.TranslationResourceRestTest.headersAfterTranslating (from TestSuite) Failing for the past 1 build (Since #1838 ) Took 0.19 sec. Error Message Expected: is "Administrator <root@localhost>" but: was "" Stacktrace java.lang.AssertionError: Expected: is "Administrator <root@localhost>" but: was "" at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20) at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:8) at org.zanata.rest.service.TranslationResourceRestTest.headersAfterTranslating(TranslationResourceRestTest.java:914) == Also, this test contains asserting for-loops which are not appropriate in tests, for safety and readability. In this particular case if the collection is empty, or the headers don't match, the test will pass which is incorrect. There are several instances of the same code behaviour in the above class, which should be altered to something like for (HeaderEntry entry : header.getEntries()) { somehashmap.put(entry.getKey(), entry.getValue.trim()) } assertThat(somehashmap.get(HeaderFields.KEY_LastTranslator), is("Administrator <root@localhost>")); assertThat(somehashmap.get(HeaderFields.KEY_PoRevisionDate).length(), greaterThan(0)); The behaviour of the above cannot otherwise be properly verified.

    JIRA | 2 years ago | Damian Jansen
    java.lang.AssertionError: Expected: is "Administrator <root@localhost>" but: was ""
  3. 0

    Build not working in Windows

    GitHub | 2 years ago | hypery2k
    java.lang.AssertionError: Expected: iterable containing ["some-component/specs/image.png"] but: item 0: was "some-component/specs\image.png"
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Build fails during :sagan-site:integTest

    GitHub | 3 years ago | as1s
    java.lang.AssertionError: Expected: "Spring Tool Suiteâ„¢ Downloads" but: was "Spring Tool Suite™ Downloads"
  6. 0

    RiverMongoInitialTimestampTest fails in isolation

    GitHub | 3 years ago | kdkeck
    java.lang.AssertionError: Expected: <0L> but: was <1L>

  1. bernardpaulus 7 times, last 6 days ago
  2. ivanszkypeter 6 times, last 7 days ago
  3. rsprangemeijer 1 times, last 1 week ago
  4. marcbouvierdav 1 times, last 2 weeks ago
  5. olle.hallin 1 times, last 3 weeks ago
10 more registered users
3 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.AssertionError

    Expected: is "Administrator <root@localhost>" but: was ""

    at org.hamcrest.MatcherAssert.assertThat()
  2. Hamcrest
    MatcherAssert.assertThat
    1. org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
    2. org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:8)
    2 frames
  3. org.zanata.rest
    TranslationResourceRestTest.headersAfterTranslating
    1. org.zanata.rest.service.TranslationResourceRestTest.headersAfterTranslating(TranslationResourceRestTest.java:914)
    1 frame