title: How to verify if method is called on System under test (not a mock)
body: <p>I'm trying to write a unit test that needs to confirm if a method is called or not.  I'm using JUnit, Mockito and PowerMock.</p>
  
  <pre>
  public class Invoice
  {
  
    protected void createInvoice()
    {
      // random stuff here
      markInvoiceAsBilled("57");
    }
  
    protected void markInvoiceAsBilled(String code)
    {
      // marked as billed
    } 
  }
  </pre>
  
  <p>So, here my system under test is <code>Invoice</code>.  I'm running this test:</p>
  
  <pre>
    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
      }
    }
  </pre>
  
  <p>This example is just an example of what the actual code looks like.... </p>
  
  <p>My problem is that mockito says you can only verify if a method is called on a mocked object... but I don't want to mock this object, as it's my object under test.  I know that you can spy on the object you're testing, so here's what I tried:</p>
  
  <pre>
  
    verify(sutSpy).markInvoiceAsBilled("57");
  </pre>
  
  <p>Is what I'm trying to do not possible?  Or am I just going about it the wrong way?</p>
  
  <p>Thanks everyone :)</p>