jeudi 11 octobre 2018

mocktio verify parameter order

I have been searching for this for a while with no answer.

lets say I have a class Service which uses Calc a dependency

Calc has a method divide

public void divide(int a,int b)

and Service uses it like so

public void serviceAMethod{
//do somehting
a=getA();
b=getB();
calc.divide(a,b);
}

and my test looks like this

@Test
public void serviceAMethod_callsCalc(){
   verify(calcMock).divide(a, b);
}

this passes, but if I go to Calc.divide and change the signature to

public void divide(int b,int a)

it still passes how do i test that the correct arguments are passed in correct order?

Aucun commentaire:

Enregistrer un commentaire