Skip to content

Instantly share code, notes, and snippets.

@tonypiazza
Last active September 27, 2015 10:28
Show Gist options
  • Save tonypiazza/1255701 to your computer and use it in GitHub Desktop.
Save tonypiazza/1255701 to your computer and use it in GitHub Desktop.
Example usage of the assertThat method of the org.junit.Assert class
@Test
public void canGetAuctionsForUsername() throws ServiceException {
String username = "tpiazza";
Auction[] auctions = new Auction[5 + new Random().nextInt(16)];
for(int i = 0; i < auctions.length; i++) {
Auction auction = createDummyAuction( username );
auctions[i] = auction;
service.saveAuction( auction );
}
assertThat( service.getAuctions(username), hasItems(auctions) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment