Skip to content

Instantly share code, notes, and snippets.

@jasongorman
Created April 15, 2021 07:27
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 jasongorman/88a183b24e2f9da700b408a410c4ade2 to your computer and use it in GitHub Desktop.
Save jasongorman/88a183b24e2f9da700b408a410c4ade2 to your computer and use it in GitHub Desktop.
public class WarehouseTest {
@Test
public void buyCd(){
CD cd = new CD(10, 9.99);
CreditCard card = mock(CreditCard.class);
Warehouse warehouse = new Warehouse();
warehouse.buy(cd, 1, card);
assertEquals(9, cd.getStock());
verify(card).charge(9.99);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment