-
Notifications
You must be signed in to change notification settings - Fork 481
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
#642 Support the conversion of String In Map To Enum #643
Conversation
|| Character.class.equals(aClass) | ||
|| Boolean.class.equals(aClass) | ||
|| java.util.Date.class.isAssignableFrom(aClass) | ||
|| java.util.Calendar.class.isAssignableFrom(aClass); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add aClass.isEnum() at the end so the diff, is just 1 line, instead of 7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Accepted
testEnumMapsToNonexistEnumValueEE.expectMessage("No enum constant com.github.dozermapper.core.vo.enumtest.DestType.BAR"); | ||
testEnumMapsToNonexistEnumValueEE.expect(IllegalArgumentException.class); | ||
testEnumMapsToNonexistEnumValueEE.expectMessage("Cannot convert [BAR] to enum of type class com.github.dozermapper.core.vo.enumtest.DestType"); | ||
testEnumMapsToNonexistEnumValueEE.expect(MappingException.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whys this changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IllegalArgumentException is caught in com.github.dozermapper.core.converters.EnumConverter#convert and then it is wrapped in MappingException and threw out.
So the expected exception should be MappingException, not the original IllegalArgumentException.
Issue link
#642 Support the conversion of String In Map To Enum
Purpose
Support the conversion of String In Map To Enum
Approach
Make PrimitiveOrWrapperConverter accepts Enum type for destination object.
Open Questions and Pre-Merge TODOs