forked from pierront/mylibrary-template
Compare commits
2 Commits
6218b38817
...
425c05fd23
Author | SHA1 | Date | |
---|---|---|---|
|
425c05fd23 | ||
|
11a123a2ed |
@@ -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.*;
|
||||||
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 io.cucumber.datatable.DataTable;
|
import io.cucumber.datatable.DataTable;
|
||||||
import io.cucumber.java.en.And;
|
import io.cucumber.java.en.And;
|
||||||
import io.cucumber.java.en.Given;
|
import io.cucumber.java.en.Given;
|
||||||
import io.cucumber.java.en.Then;
|
import io.cucumber.java.en.Then;
|
||||||
import io.cucumber.java.en.When;
|
import io.cucumber.java.en.When;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.*;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class OrderSteps {
|
public class OrderSteps {
|
||||||
|
|
||||||
}
|
|
||||||
|
}
|
||||||
|
@@ -3,13 +3,13 @@
|
|||||||
Feature: Manage orders
|
Feature: Manage orders
|
||||||
|
|
||||||
Background:
|
Background:
|
||||||
Given the system has the following customers:
|
Given the order system has the following customers:
|
||||||
| id | firstName | lastName | phoneNumber | loyaltyPoints |
|
| id | firstName | lastName | phoneNumber | loyaltyPoints |
|
||||||
| 22222222-2222-2222-2222-222222222222 | Bob | Brown | 0600000002 | 200 |
|
| 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 |
|
| isbn | title | author | publisher | publicationDate | price | quantity | language |
|
||||||
| 978222222 | Book A | Author A | PubA | 2021-01-01 | 12.0 | 10 | EN |
|
| 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 |
|
| id | customerId | totalPrice | paymentMethod |
|
||||||
| ord-1 | 22222222-2222-2222-2222-222222222222 | 24.0 | CREDIT_CARD |
|
| 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 |
|
| customerId | paymentMethod | orderLineDtos | addressStreet | addressCity | addressPostalCode | addressCountry |
|
||||||
| 22222222-2222-2222-2222-222222222222 | CREDIT_CARD | [{ "bookId":978222222, "quantity":2 }] | 1 Main St | Paris | 75000 | France |
|
| 22222222-2222-2222-2222-222222222222 | CREDIT_CARD | [{ "bookId":978222222, "quantity":2 }] | 1 Main St | Paris | 75000 | France |
|
||||||
Then the order is created successfully
|
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
|
Scenario: Get order by ID
|
||||||
When I request the order with id "ord-1"
|
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:
|
When I try to create a new order with the following information:
|
||||||
| customerId | paymentMethod | orderLineDtos | addressStreet | addressCity | addressPostalCode | addressCountry |
|
| customerId | paymentMethod | orderLineDtos | addressStreet | addressCity | addressPostalCode | addressCountry |
|
||||||
| 22222222-2222-2222-2222-222222222222 | CREDIT_CARD | [{ "bookId":978222222, "quantity":20 }] | 1 Main St | Paris | 75000 | France |
|
| 22222222-2222-2222-2222-222222222222 | CREDIT_CARD | [{ "bookId":978222222, "quantity":20 }] | 1 Main St | Paris | 75000 | France |
|
||||||
Then the creation fails
|
Then the order creation fails
|
||||||
And I receive an error message containing "book quantity insufficient"
|
And I receive an order error message containing "book quantity insufficient"
|
||||||
And the system still has 1 order
|
And the order system still has 1 order
|
||||||
|
|
||||||
Scenario: Attempt to create an order with invalid details
|
Scenario: Attempt to create an order with invalid details
|
||||||
When I try to create a new order with the following information:
|
When I try to create a new order with the following information:
|
||||||
| customerId | paymentMethod | orderLineDtos | addressStreet | addressCity | addressPostalCode | addressCountry |
|
| customerId | paymentMethod | orderLineDtos | addressStreet | addressCity | addressPostalCode | addressCountry |
|
||||||
| | | | | | | |
|
| | | | | | | |
|
||||||
Then the creation fails
|
Then the order creation fails
|
||||||
And I receive an error message containing "Invalid order details or address"
|
And I receive an order error message containing "Invalid order details or address"
|
||||||
And the system still has 1 order
|
And the order system still has 1 order
|
||||||
|
|
||||||
Scenario: Attempt to create an order for unknown customer
|
Scenario: Attempt to create an order for unknown customer
|
||||||
When I try to create a new order with the following information:
|
When I try to create a new order with the following information:
|
||||||
| customerId | paymentMethod | orderLineDtos | addressStreet | addressCity | addressPostalCode | addressCountry |
|
| customerId | paymentMethod | orderLineDtos | addressStreet | addressCity | addressPostalCode | addressCountry |
|
||||||
| 99999999-9999-9999-9999-999999999999 | CREDIT_CARD | [{ "bookId":978222222, "quantity":2 }] | 1 Main St | Paris | 75000 | France |
|
| 99999999-9999-9999-9999-999999999999 | CREDIT_CARD | [{ "bookId":978222222, "quantity":2 }] | 1 Main St | Paris | 75000 | France |
|
||||||
Then the creation fails
|
Then the order creation fails
|
||||||
And I receive an error message containing "Customer not found"
|
And I receive an order error message containing "Customer not found"
|
||||||
And the system still has 1 order
|
And the order system still has 1 order
|
||||||
|
|
||||||
Scenario: Attempt to get order by unknown ID
|
Scenario: Attempt to get order by unknown ID
|
||||||
When I request the order with id "unknown-order-id"
|
When I request the order with id "unknown-order-id"
|
||||||
Then the request fails
|
Then the order request fails
|
||||||
And I receive an error message containing "Order not found"
|
And I receive an order error message containing "Order not found"
|
||||||
|
Reference in New Issue
Block a user