Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JacksonArbitraryIntrospector used instead of FieldReflectionArbitraryIntrospector #536

Closed
esfomeado opened this issue Jan 3, 2023 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@esfomeado
Copy link
Contributor

Describe the bug

If I set a field to use the JacksonArbitraryIntrospector all the field fields will now use the JacksonArbitraryIntrospector instead the default one.

Your environment

Java 17

FixtureMonkey - 0.4.10

Steps to reproduce

Run invalidIntrospector on https://github.com/esfomeado/fixture-monkey-bug/blob/f5ca2c55e543a04cab279245fddfe6b946f59e5a/src/test/java/com/example/bug/FixtureMonkeyTest.java

Expected behaviour

Should generate the class correctly.

Actual behaviour

Class not generated.

Cannot construct instance of com.example.bug.Condition (no Creators, like default constructor, exist): abstract types either need to be mapped to concrete types, have custom deserializer, or contain additional type information

@esfomeado esfomeado added the bug Something isn't working label Jan 3, 2023
@seongahjo seongahjo self-assigned this Jan 9, 2023
@seongahjo
Copy link
Contributor

seongahjo commented Jan 9, 2023

@esfomeado
It fails due to Jackson.
When generating an object by JacksonArbitraryIntrospector, it serializes all of fields and then deserializes.
So in this case, it fails when serialize and deserialize conditions.

In this case @JsonSubTypes and @JsonTypeInfo is needed, but it is not supported in Fixture Monkey yet.
It is supported soon.

public final class ElementJsonSubTypesObjectPropertyGenerator implements ObjectPropertyGenerator {

I think JacksonArbitraryIntrospector should be improved, so I'll figure out if any better solutions when improving JacksonArbitraryIntrospector.

@esfomeado
Copy link
Contributor Author

@seongahjo Sorry, you are correct. It was been a long day.

But I've encountered this issue that I mentioned. I will close this bug in the meantime and I will open it again once I have a better replication.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants