I am new to java and Unit testing. I am facing a problem in writing a unit test to one of the test methods. Can you please help me with this.
In different .class file
Class classA{
/*......*/
classB method1_ClassA(parameters){
/*.....
.....
.....
.....
.....*/
String some_Identifier = method2_ClassA(parameters)
}
public String method2_ClassA(parameters){
/*contains call to the database*/
}
}
In different .class file
Class classB{
/*.....*/
}
In different .class file
Class classC{
/*.......*/
public classB method1_ClassC(parameters){
classA obj_ClassA = new classA();
return obj_ClassA.method1_classA(parameters);
}
/*.......*/
}
I am trying to do Unit Testing to the classC. One of the methods in ClassC calls a method of class A. I tried to mock this method, which is method1_classA. But this method has a call to another method which is present in the same class. Can somebody please help me on how to create a unit test for classC.
Aucun commentaire:
Enregistrer un commentaire