Compare commits

..

2 Commits

Author SHA1 Message Date
Kroccmou
425c05fd23 Update OrderSteps.java 2025-06-13 23:50:26 +02:00
Kroccmou
11a123a2ed Update order.feature 2025-06-13 23:50:21 +02:00
2 changed files with 21 additions and 27 deletions

View File

@@ -1,22 +1,16 @@
package fr.iut_fbleau.but3.dev62.mylibrary.features.client;
package fr.iut_fbleau.but3.dev62.mylibrary.features.order;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.*;
import io.cucumber.datatable.DataTable;
import io.cucumber.java.en.And;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
import java.util.*;
public class OrderSteps {
}
}

View File

@@ -3,13 +3,13 @@
Feature: Manage orders
Background:
Given the system has the following customers:
Given the order system has the following customers:
| id | firstName | lastName | phoneNumber | loyaltyPoints |
| 22222222-2222-2222-2222-222222222222 | Bob | Brown | 0600000002 | 200 |
And the system has the following books:
And the order system has the following books:
| isbn | title | author | publisher | publicationDate | price | quantity | language |
| 978222222 | Book A | Author A | PubA | 2021-01-01 | 12.0 | 10 | EN |
And the system has the following orders:
And the order system has the following orders:
| id | customerId | totalPrice | paymentMethod |
| ord-1 | 22222222-2222-2222-2222-222222222222 | 24.0 | CREDIT_CARD |
@@ -18,7 +18,7 @@ Feature: Manage orders
| customerId | paymentMethod | orderLineDtos | addressStreet | addressCity | addressPostalCode | addressCountry |
| 22222222-2222-2222-2222-222222222222 | CREDIT_CARD | [{ "bookId":978222222, "quantity":2 }] | 1 Main St | Paris | 75000 | France |
Then the order is created successfully
And the system now has 2 orders
And the order system now has 2 orders
Scenario: Get order by ID
When I request the order with id "ord-1"
@@ -30,27 +30,27 @@ Feature: Manage orders
When I try to create a new order with the following information:
| customerId | paymentMethod | orderLineDtos | addressStreet | addressCity | addressPostalCode | addressCountry |
| 22222222-2222-2222-2222-222222222222 | CREDIT_CARD | [{ "bookId":978222222, "quantity":20 }] | 1 Main St | Paris | 75000 | France |
Then the creation fails
And I receive an error message containing "book quantity insufficient"
And the system still has 1 order
Then the order creation fails
And I receive an order error message containing "book quantity insufficient"
And the order system still has 1 order
Scenario: Attempt to create an order with invalid details
When I try to create a new order with the following information:
| customerId | paymentMethod | orderLineDtos | addressStreet | addressCity | addressPostalCode | addressCountry |
| | | | | | | |
Then the creation fails
And I receive an error message containing "Invalid order details or address"
And the system still has 1 order
Then the order creation fails
And I receive an order error message containing "Invalid order details or address"
And the order system still has 1 order
Scenario: Attempt to create an order for unknown customer
When I try to create a new order with the following information:
| customerId | paymentMethod | orderLineDtos | addressStreet | addressCity | addressPostalCode | addressCountry |
| 99999999-9999-9999-9999-999999999999 | CREDIT_CARD | [{ "bookId":978222222, "quantity":2 }] | 1 Main St | Paris | 75000 | France |
Then the creation fails
And I receive an error message containing "Customer not found"
And the system still has 1 order
Then the order creation fails
And I receive an order error message containing "Customer not found"
And the order system still has 1 order
Scenario: Attempt to get order by unknown ID
When I request the order with id "unknown-order-id"
Then the request fails
And I receive an error message containing "Order not found"
Then the order request fails
And I receive an order error message containing "Order not found"