I have a interface fly
and a class duck
which implements fly
.
interface Fly {
getWingSize();
}
public class Duck implements Fly {
@Override
int getWingSize(){
return 1;
}
}
In my controller class, when I try to use the following:
Fly flyAnimal = Animal.getFlyingAnimal();
((Duck) flyAnimal).getWingSize();
It works fine, however in my junit, it gives a class cast exception. I am using powermockito.