@Test public void shouldGetFirstProductInStockOfProvidedType() throws DataNotFoundException, RemoteException { Product firstProductOfTypeBook = onlineStore.getFirstProductOfType("Book"); Assert.assertEquals(p1, firstProductOfTypeBook); }
@Test public void shouldGetAllBooksInStock() throws DataNotFoundException, RemoteException { Product[] books = onlineStore.getProductsOfType("Book"); List<Product> booksList = Arrays.asList(books); Assert.assertTrue(booksList.contains(p1)); Assert.assertTrue(booksList.contains(p3)); }
@Test(expected = DataNotFoundException.class) public void shouldThrowDataNotFoundExceptionIfNoProductOfProvidedTypeIsFound() throws DataNotFoundException, RemoteException { onlineStore.getProductsOfType("computer"); }
@Test public void shouldGetBestOfferOfTypeBook() throws DataNotFoundException, RemoteException { Product booksBestOffer = onlineStore.getBestOfferOfType("Book"); Assert.assertEquals(p3, booksBestOffer); }