Skip to content

Instantly share code, notes, and snippets.

@jasongorman
Created December 30, 2020 10:12
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/d27bfe5d1fb6d6092e8c1f845e152420 to your computer and use it in GitHub Desktop.
Save jasongorman/d27bfe5d1fb6d6092e8c1f845e152420 to your computer and use it in GitHub Desktop.
public class StockMonitorTest {
@Test
public void alertSentWhenProductNeedsReordering() {
Alert alert = mock(Alert.class);
ReorderLevel reorderLevel = product1 -> 10;
Product product = new Product(811, 11, 14);
Warehouse warehouse = productId -> product;
StockMonitor monitor = new StockMonitor(alert, warehouse, reorderLevel);
monitor.productSold(811, 1);
verify(alert).send(product);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment