Skip to content

Commit

Permalink
remove declaration of method already implemented with different name
Browse files Browse the repository at this point in the history
close #17
  • Loading branch information
FrancescoScandiffio committed Jan 23, 2022
1 parent 313c3ba commit f1188fa
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public void cancelShopping() {
List<OrderItem> items = order.getItems();
if (!items.isEmpty()) {
order.clear();
totemView.clearOrderList();
totemView.allItemsRemoved();
for (OrderItem item : items) {
broker.returnProduct(item.getProduct().getId(), item.getQuantity());
}
Expand All @@ -120,7 +120,7 @@ public void confirmOrder() {

orderRepository.save(order);
totemView.showGoodbye();
totemView.clearOrderList();
totemView.allItemsRemoved();
order = null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ public interface TotemView {

void showAllProducts(List<Product> allProducts);

void allItemsRemoved();

void showWelcome();

void itemAdded(OrderItem item);
Expand All @@ -31,7 +29,7 @@ public interface TotemView {

void showErrorMessage(String msg);

void clearOrderList();
void allItemsRemoved();

void showGoodbye();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,9 @@ public void itemAdded(OrderItem newItem) {
getCartPane().getListOrderItemsModel().addElement(newItem);
}

@Override
public void clearOrderList() {
getCartPane().getListOrderItemsModel().clear();
}

@Override
public void allItemsRemoved() {
// TODO Auto-generated method stub

getCartPane().getListOrderItemsModel().clear();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ void testCancelShoppingWhenOneItemIsPresent() {
totemController.cancelShopping();
verify(order).clear();
verify(broker).returnProduct(product.getId(), QUANTITY);
verify(totemView).clearOrderList();
verify(totemView).allItemsRemoved();
verify(totemView).showWelcome();

}
Expand All @@ -337,7 +337,7 @@ void testCancelShoppingWhenSeveralItemArePresent() {
verify(order).clear();
verify(broker).returnProduct(product.getId(), QUANTITY);
verify(broker).returnProduct(product_2.getId(), QUANTITY);
verify(totemView).clearOrderList();
verify(totemView).allItemsRemoved();
verify(totemView).showWelcome();
}

Expand All @@ -358,7 +358,7 @@ void testConfirmOrderWhenOrderIsNotEmpty() {
InOrder inOrder = inOrder(totemView, orderRepository);
inOrder.verify(orderRepository).save(order);
inOrder.verify(totemView).showGoodbye();
inOrder.verify(totemView).clearOrderList();
inOrder.verify(totemView).allItemsRemoved();
assertThat(totemController.getOrder()).isNull();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -456,13 +456,13 @@ void testItemModifiedShouldUpdateTheOldOrderItemWithTheNewOneInCartList() {

@Test
@GUITest
@DisplayName("Method 'clearOrderList' should remove all items from the cart list")
void testClearOrderListShouldClearTheCartList() {
@DisplayName("Method 'allItemsRemoved' should remove all items from the cart list")
void testAllItemsRemovedShouldClearTheCartList() {
GuiActionRunner.execute(() -> totemSwingView.getCartPane().getListOrderItemsModel()
.addElement(new OrderItem(new Product(1, "Product1", 2), 5)));
GuiActionRunner.execute(() -> totemSwingView.getCartPane().getListOrderItemsModel()
.addElement(new OrderItem(new Product(1, "Product2", 3), 4)));
GuiActionRunner.execute(() -> totemSwingView.clearOrderList());
GuiActionRunner.execute(() -> totemSwingView.allItemsRemoved());
String[] listContents = window.list("cartList").contents();
assertThat(listContents).isEmpty();
}
Expand Down

0 comments on commit f1188fa

Please sign in to comment.