Added test case for nullable enum that defaults to null and defaults … #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…to an enum value is not null.
Hi Kossi,
Thank you for looking at this issue so quick!
Your solution looks good.
I added one test case. I wanted to see if I could make it work for a nullable enum that defaults to null and defaults to a value in the enum if it is not null.
I had to create a data class with just the enum in it and give it the default value, then make that enum class the nullable field for it to work. I could not think of another way to do it since I can't give an enum two default values. Even if I could, I don't know how it would choose which to use.
I just wanted to see if it were possible because I'm sure cases will come up where the value can be null and if it is not, people will want the value to have a default for backward compatibility.