pjfanning / jackson-scala-reflect-extensions

Extension to jackson-module-scala that uses scala-reflect to get type info
Apache License 2.0
1 stars 2 forks source link

Add test to discover bug with nested options #4

Closed AntoineDuComptoirDesPharmacies closed 2 years ago

AntoineDuComptoirDesPharmacies commented 2 years ago

Simple Pull Request to add a test case that is not covered by the library yet.

pjfanning commented 2 years ago

@AntoineDuComptoirDesPharmacies these tests pass - how do you reproduce the bug?

AntoineDuComptoirDesPharmacies commented 2 years ago

You are right !

I think that it is due to the fact that we are using the same instance of mapper/extension from one test to another. Thus, if we run the first test before, the instance are enriched with sufficient informations to determine the Long type of id.

It is easy to reproduce by changing the order of tests, running "deserialize id in nested option as Long" before.

pjfanning commented 2 years ago

I've added equivalents of your tests on main branch. Both fail and I've set them to ignore.

The false positives in the test runs are due to the fact that ScalaAnnotationIntrospectorModule.registerReferenceType can be set in one test and the state wasn't cleared between tests.

It might take me a while to get back and try to fix the tests. Some other tests that I thought were passing are now failing after I added the beforeEach/afterEach code to clear the ScalaAnnotationIntrospectorModule state.