With a given enum like
public enum Colors {
RED("ff0000"),
BLUE("0000ff"),
SILVER("eeeeee");
private String code;
public Colors(String code) {
this.code = code;
}
public void paint(Car car) {
car.applyColor(code);
}
}
I'd like to verify in a test, that paint
is called with a certain car
on enum RED
. I thought about mocking the enum class (mockStatic
) or spying on it, but couldn't find a way yet to verify
the method call. I want to avoid calling the real method implementation on the test.
Please note: This is a very simplified example of the real code