I know that you can make fun of a single enumeration (using How to mock a singleton enum class using Mockito / Powermock? ), But I have 1000 enum and they can call 5 different constructors. Enumeration values ββoften change during development.
I want to really make fun of only one or two for my JUnit test. I donβt care about the others, but they are still created, which causes some unpleasant things that load values ββfor listing from the file system.
Yes, I know this is a very bad design. But so far I do not have time to change it.
We are currently using Mockito / powermock. But any structure that can solve this problem, I mean, poor design is welcome.
Let's say I have an enumeration similar to this:
public static enum MyEnum { A(OtherEnum.CONSTANT), B("1"), C("1", OtherEnum.CONSTANT),
java enums junit mocking suppression
keiki
source share