Skip to content

Date tests sometimes (less than 0.1% of the time) fail #2806

@Zegveld

Description

@Zegveld

I've seen tests fail randomly, so this will also make some mappings inconsistent at rare moments.
Chance of happening seems to be below 0.1% of the time, but would be nice if this was 0%.

  1. DateConversionTest.shouldApplyDateFormatForConversionsJdk11
[INFO] Running org.mapstruct.ap.test.injectionstrategy.jsr330._default.Jsr330DefaultCompileOptionFieldMapperTest
Error:  Tests run: 22, Failures: 1, Errors: 0, Skipped: 2, Time elapsed: 0.906 s <<< FAILURE! - in org.mapstruct.ap.test.conversion.date.DateConversionTest
Error:  org.mapstruct.ap.test.conversion.date.DateConversionTest.shouldApplyDateFormatForConversionsJdk11  Time elapsed: 0.337 s  <<< FAILURE!
org.opentest4j.AssertionFailedError: 

Expecting:
 <"05.07.2013">
to be equal to:
 <"06.07.2013">
but was not.
	at org.mapstruct.ap.test.conversion.date.DateConversionTest.shouldApplyDateFormatForConversionsJdk11(DateConversionTest.java:66)
  1. NestedMappingMethodInvocationTest
    Another failed test:
 [INFO] Running org.mapstruct.ap.test.nestedmethodcall.NestedMappingMethodInvocationTest
Error:  Tests run: 9, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.525 s <<< FAILURE! - in org.mapstruct.ap.test.nestedmethodcall.NestedMappingMethodInvocationTest
Error:  org.mapstruct.ap.test.nestedmethodcall.NestedMappingMethodInvocationTest.shouldMapViaMethodAndConversion  Time elapsed: 0.252 s  <<< FAILURE!
org.opentest4j.AssertionFailedError: 

Expecting:
 <2013-07-05T22:00:00.000 (java.util.Date)>
to be equal to:
 <2013-07-06T00:00:00.000 (java.util.Date)>
but was not.
	at org.mapstruct.ap.test.nestedmethodcall.NestedMappingMethodInvocationTest.shouldMapViaMethodAndConversion(NestedMappingMethodInvocationTest.java:74)
  1. VariableNamingTest
    and another one
    been a while, but here again (30-05-2022):
INFO] Running org.mapstruct.ap.test.builtin.BuiltInTest
Error:  Tests run: 3, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.475 s <<< FAILURE! - in org.mapstruct.ap.test.naming.VariableNamingTest
Error:  org.mapstruct.ap.test.naming.VariableNamingTest.shouldGenerateImplementationsOfMethodsWithProblematicVariableNmes  Time elapsed: 0.202 s  <<< FAILURE!
java.lang.AssertionError: 

Expecting map:
 <{"121"="19.07.2013", "42"="31.12.1979"}>
to contain:
 <[MapEntry[key="42", value="01.01.1980"],
    MapEntry[key="121", value="20.07.2013"]]>
but could not find the following map entries:
 <[MapEntry[key="42", value="01.01.1980"],
    MapEntry[key="121", value="20.07.2013"]]>

	at org.mapstruct.ap.test.naming.VariableNamingTest.shouldGenerateImplementationsOfMethodsWithProblematicVariableNmes(VariableNamingTest.java:50)
  1. DateConversionTest.shouldApplyStringConversionForReverseArrayMethod
    once more,
    Failed test:
 [INFO] Running org.mapstruct.ap.test.conversion.date.DateConversionTest
Error:  Tests run: 25, Failures: 1, Errors: 0, Skipped: 2, Time elapsed: 0.566 s <<< FAILURE! - in org.mapstruct.ap.test.conversion.date.DateConversionTest
Error:  org.mapstruct.ap.test.conversion.date.DateConversionTest.shouldApplyStringConversionForReverseArrayMethod  Time elapsed: 0.004 s  <<< FAILURE!
java.lang.AssertionError: 

Expecting:
  <[2013-07-05T22:00:00.000 (java.util.Date),
    2013-02-14T00:00:00.000 (java.util.Date),
    2013-04-11T00:00:00.000 (java.util.Date)]>
to contain exactly (and in same order):
  <[2013-07-06T00:00:00.000 (java.util.Date),
    2013-02-14T00:00:00.000 (java.util.Date),
    2013-04-11T00:00:00.000 (java.util.Date)]>
but some elements were not found:
  <[2013-07-06T00:00:00.000 (java.util.Date)]>
and others were not expected:
  <[2013-07-05T22:00:00.000 (java.util.Date)]>

	at org.mapstruct.ap.test.conversion.date.DateConversionTest.shouldApplyStringConversionForReverseArrayMethod(DateConversionTest.java:153)
  1. MapMappingTest.shouldCreateReverseMapMethodImplementation
    Failed test
Error:  Tests run: 21, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.582 s <<< FAILURE! - in org.mapstruct.ap.test.collection.map.MapMappingTest
Error:  org.mapstruct.ap.test.collection.map.MapMappingTest.shouldCreateReverseMapMethodImplementation  Time elapsed: 0.013 s  <<< FAILURE!
java.lang.AssertionError: 

Expecting map:
 <{42L=1979-12-31T23:00:00.000 (java.util.Date), 121L=2013-07-19T22:00:00.000 (java.util.Date)}>
to contain:
 <[MapEntry[key=42L, value=1980-01-01T00:00:00.000 (java.util.Date)],
    MapEntry[key=121L, value=2013-07-20T00:00:00.000 (java.util.Date)]]>
but could not find the following map entries:
 <[MapEntry[key=42L, value=1980-01-01T00:00:00.000 (java.util.Date)],
    MapEntry[key=121L, value=2013-07-20T00:00:00.000 (java.util.Date)]]>

	at org.mapstruct.ap.test.collection.map.MapMappingTest.assertResult(MapMappingTest.java:102)
	at org.mapstruct.ap.test.collection.map.MapMappingTest.shouldCreateReverseMapMethodImplementation(MapMappingTest.java:53)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions