Skip to content

Instantly share code, notes, and snippets.

@rija-javed
Last active December 24, 2015 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rija-javed/6819180 to your computer and use it in GitHub Desktop.
Save rija-javed/6819180 to your computer and use it in GitHub Desktop.
mockery.checking(new WExpectations() {{
//Create a mockery of the ReportPublisher and CBUS class
q.reporter = mockery.mock(ReportPublisher.class);
q.cbusClient = mockery.mock(CBUS.class);
//Invoke one instance of the ReportPublisher mock object with the send method
one(q.reporter).send(with(havingRows(2)), with(any(ReportCategory.class)), with(equal(SEVERE)));
//Invoke one instance of the CBUS mock object with the send method
one(q.cbusClient).invoke(with(query(new GetEtfModels())));
//The above actions will return a list containing the etfModelView1 and etfModelView2 variables
will(returnList(etfModelView1,
etfModelView2));
}});
//Verify the expected methods were called as specified
mockery.assertIsSatisfied();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment