org.junit.ComparisonFailure: expected:<...ibuteOverridingTest$[D]> but was:<...ibuteOverridingTest$[C]>

Hibernate JIRA | Osamu Nagano | 12 months 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

    Attached test case, InheritedAttributeOverridingTest.java, has 3 tests. The first 2 tests are able to pass by a fix of HHH-9485 (introduced between Hibernate ORM 5.0.8 and 5.0.9), while the 3rd test still fails with the following error. {code} org.junit.ComparisonFailure: expected:<...ibuteOverridingTest$[D]> but was:<...ibuteOverridingTest$[C]> at org.junit.Assert.assertEquals(Assert.java:115) at org.junit.Assert.assertEquals(Assert.java:144) at org.hibernate.test.annotations.override.InheritedAttributeOverridingTest.testInheritedAttributeOverridingTargetEntity(InheritedAttributeOverridingTest.java:86) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.hibernate.testing.junit4.ExtendedFrameworkMethod.invokeExplosively(ExtendedFrameworkMethod.java:45) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.internal.runners.statements.FailOnTimeout$StatementThread.run(FailOnTimeout.java:74) {code} Where subclass {{D}} is expected while its superclass {{C}} is actually returned. {code} 185 @Entity( name = "F" ) 186 public static class F extends E { 187 @ManyToOne(targetEntity=D.class) 188 public C getTarget() { 189 return super.getTarget(); 190 } 191 } {code}

    Hibernate JIRA | 12 months ago | Osamu Nagano
    org.junit.ComparisonFailure: expected:<...ibuteOverridingTest$[D]> but was:<...ibuteOverridingTest$[C]>
  2. 0

    Attached test case, InheritedAttributeOverridingTest.java, has 3 tests. The first 2 tests are able to pass by a fix of HHH-9485 (introduced between Hibernate ORM 5.0.8 and 5.0.9), while the 3rd test still fails with the following error. {code} org.junit.ComparisonFailure: expected:<...ibuteOverridingTest$[D]> but was:<...ibuteOverridingTest$[C]> at org.junit.Assert.assertEquals(Assert.java:115) at org.junit.Assert.assertEquals(Assert.java:144) at org.hibernate.test.annotations.override.InheritedAttributeOverridingTest.testInheritedAttributeOverridingTargetEntity(InheritedAttributeOverridingTest.java:86) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.hibernate.testing.junit4.ExtendedFrameworkMethod.invokeExplosively(ExtendedFrameworkMethod.java:45) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.internal.runners.statements.FailOnTimeout$StatementThread.run(FailOnTimeout.java:74) {code} Where subclass {{D}} is expected while its superclass {{C}} is actually returned. {code} 185 @Entity( name = "F" ) 186 public static class F extends E { 187 @ManyToOne(targetEntity=D.class) 188 public C getTarget() { 189 return super.getTarget(); 190 } 191 } {code}

    Hibernate JIRA | 12 months ago | Osamu Nagano
    org.junit.ComparisonFailure: expected:<...ibuteOverridingTest$[D]> but was:<...ibuteOverridingTest$[C]>
  3. 0

    AlertingTest failing in json comparison

    GitHub | 3 years ago | sammefford
    org.junit.ComparisonFailure: expected:<...ule-metadata":null}}[]> but was:<...ule-metadata":null}}[ ]>
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Running the tests, deploying to an internal maven, & updating versions

    GitHub | 2 years ago | jtruelove
    org.junit.ComparisonFailure: expected:<[error]> but was:<[ok]>
  6. 0

    Cookies tests are flaky

    GitHub | 3 years ago | seato
    org.junit.ComparisonFailure: expected:<[GM]20527.group.on> but was:<[gm]20527.group.on>
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. org.junit.ComparisonFailure

    expected:<...ibuteOverridingTest$[D]> but was:<...ibuteOverridingTest$[C]>

    at org.junit.Assert.assertEquals()
  2. JUnit
    Assert.assertEquals
    1. org.junit.Assert.assertEquals(Assert.java:115)
    2. org.junit.Assert.assertEquals(Assert.java:144)
    2 frames
  3. org.hibernate.test
    InheritedAttributeOverridingTest.testInheritedAttributeOverridingTargetEntity
    1. org.hibernate.test.annotations.override.InheritedAttributeOverridingTest.testInheritedAttributeOverridingTargetEntity(InheritedAttributeOverridingTest.java:86)
    1 frame
  4. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    4. java.lang.reflect.Method.invoke(Method.java:497)
    4 frames
  5. JUnit
    FrameworkMethod.invokeExplosively
    1. org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    2. org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    3. org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    3 frames
  6. A Hibernate O/RM Module
    ExtendedFrameworkMethod.invokeExplosively
    1. org.hibernate.testing.junit4.ExtendedFrameworkMethod.invokeExplosively(ExtendedFrameworkMethod.java:45)
    1 frame
  7. JUnit
    FailOnTimeout$StatementThread.run
    1. org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    2. org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    3. org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    4. org.junit.internal.runners.statements.FailOnTimeout$StatementThread.run(FailOnTimeout.java:74)
    4 frames