I have a final class as below
public  class firstclass{
   private String firstmethod(){
       return new secondclass("params").somemethod();
}
}
public final class secondclass{
   secondclass(String params){
        //some code
}
public String somemethod(){
         // some code 
        return somevariable";
}
}
I have to here test first class so I have mocked this as below
secondclass classMock = PowerMockito.mock(secondclass .class);
        PowerMockito.whenNew(secondclass .class).withAnyArguments().thenReturn(classMock);
Mockito.doReturn("test").when(classMock).somemethod();
But it is not mocking as I expected can anyone help me?
