jeudi 20 juillet 2017

Replaced method with long parameter list with builder pattern. How to test it with Mockito?

I had a long method that looked like this:

public class Executor {
   public void do(int a, int b, C c, D d, int e, int f);
}

I replaced this method with a builder pattern and call the method now like this:

executor.do(a).withB(b).withC(c).withD(d).withE(e).withF(f);

Previously, I tested my method like this using Mockito:

verify(mockExecutor).do(anyInt(), anyInt(), eq(c), eq(d), anyInt(), anyInt());

However, I can do that now. And I also can't use a ArgumentCaptor to capture an argument that is passed to a method. What can I do now?

Aucun commentaire:

Enregistrer un commentaire