문제

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.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top