I am writing test cases for Class A given below. but facing class cast exception bcoz of constructor casting a class into another.
class A {
private B b;
@Autowired
private RestApi api;
public A(D d){
super(d);
this.b = (B)d;
}
public someMethod(){
// Logic
}
}
where D is a parent class and Class B extends Class D.
In the Constructor I am casting Parent to child.
How to handle This constructor casting into Mockito junit.
Aucun commentaire:
Enregistrer un commentaire