I have a similar problem than this question.
I would like to implement the selected answer (the other ones don't work or apply to my case).
The problem is that the enum I want to redefine is actually inside a class.
package a.package.i.dont.own;
public class AClass {
public enum AnEnum {
A,
B
}
// Here a bunch of stuff I'm using and don't want to redefine
}
The corresponding code I want to test:
public String someMethod() {
return switch(aMethodThatReturnsAnEnumValueFromContext()) {
case A -> "foo";
case B -> "bar";
default -> null;
}
}