You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you have two enum classes with the same name but in different packages and compare an enum object in a list from one package with an enum object of the other package, it fails, but the output is confusing, as it suggests that both are the same. The fully qualified name should be added to make it easier to differentiate the two.
java.lang.AssertionError:
Expecting List12:
[CONSTANT1]
to contain:
[CONSTANT1]
but could not find the following element(s):
[CONSTANT1]
Nicer would be something like that:
java.lang.AssertionError:
Expecting List12:
[CONSTANT1 (org.example.pkg1.MyEnum)]
to contain:
[CONSTANT1 (org.example.pkg2.MyEnum)]
but could not find the following element(s):
[CONSTANT1 (org.example.pkg1.MyEnum)]
The text was updated successfully, but these errors were encountered:
This could seem to be connected to #3084 but it's not, because the underlying error message factory ShouldContain doesn't rely on UnambiguousRepresentation. Also, there are other assertions/error messages that are affected (e.g., containsExactly).
We should evaluate how to efficiently refactor this area to address everything in a uniform way.
Feature summary
When you have two enum classes with the same name but in different packages and compare an enum object in a list from one package with an enum object of the other package, it fails, but the output is confusing, as it suggests that both are the same. The fully qualified name should be added to make it easier to differentiate the two.
Example
org.example.pkg1.MyEnum.java
:org.example.pkg2.MyEnum.java
:Test:
Results in the following error:
Nicer would be something like that:
The text was updated successfully, but these errors were encountered: