Question

public class A { 
 public void m1(obj o){
   m2(params);
 }
 private void m2(params){
   String s;
   //some actions with String S
   m3(s);
 }
 private void m3(String s){
   m4(s);
 }
 private void m4(String s){

   //some actions with s
 }
}

So somehow I need to get String s that m4() recieves as a parameter, I need to catch that parameter so I can put a different obj in m1() and it will make a different string in m2() and so I can comapare them using EasyMock or maybe there is a way to do this not using EasyMock. Im stuck here and I have no idea how to do this.

a.m1(obj);

This is the usage of my class, so it calls a chain reaction that is closed by privates. I hope i did a good job explaining my problem.

Was it helpful?

Solution

If you want to test this method, you may consider making it public/protected/package local. Then you'll be able to mock or overload it in a subclass you are to test.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top