When I am mocking chain of methods do I have to write them in the below format only
when(foo.getBar()).thenReturn(bar);
when(bar.getName()).thenReturn("Foo Bar");
or could I also use the below format? because both are working for me and I am asking this question because I was told that that my second (below) approach is wrong
when(foo.getBar()).thenReturn(bar);
when(foo.getBar().getName()).thenReturn("Foo Bar");
Aucun commentaire:
Enregistrer un commentaire