I am trying to write a unit test that should confirm whether a method is called or not. I use JUnit, Mockito and PowerMock.
public class Invoice
{
protected void createInvoice ()
{
// random stuff here
markInvoiceAsBilled ("57");
}
protected void markInvoiceAsBilled (String code)
{
// marked as billed
}
}
So here is my test system Invoice. I am doing this test:
public class InvoiceTest
{
@Test
public void testInvoiceMarkedAsBilled ()
{
Invoice sut = new Invoice ();
Invoice sutSpy = spy (sut);
sut.createInvoice ();
// I want to verify that markInvoiceAsBilled () was called
}
}
This example is just an example of what the actual code looks like ....
, mockito , , ... , . , , , :
verify(sutSpy).markInvoiceAsBilled("57");
- ? ?
:)