Hi,
this PR fixes #22128 by using
Collectors.toCollection(() -> EnumSet.noneOf(DispatcherType.class))
rather thanCollectors.collectingAndThen(Collectors.toSet(), EnumSet::copyOf)
to prevent exceptions when the underlying collection is empty.
Let me know what you think. Cheers, Christoph
Comment From: dreis2211
I was undecided on that one actually. I wanted to stay consistent inside the specific tests, but I can change it of course.
Comment From: wilkinsona
The dangers of reviewing a diff in isolation. Ok, let's keep it consistent within the test classes for now. We can do a separate pass that replaces the use of ReflectionTestUtils
. hasFieldOrPropertyWithValue
would probably be a better fit than my earlier suggestion of extracting
anyway.
Comment From: dreis2211
Yeah, I think doing this in a separate pass is probably better. On top of that I think that neither hasFieldOrPropertyWithValue
nor extracting
work really great here. The former because it doesn't really play well with the empty case and the latter because it doesn't really work great with Sets (I only know of extracting().asList()
at least and a quick test didn't reveal any other cool shortcut).
Comment From: wilkinsona
Thanks very much once again, @dreis2211.