Skip to content

Commit 8630550

Browse files
committed
chore: add proper annotations to test methods
1 parent 771d84b commit 8630550

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lesson_14/exceptions/exceptions_app/src/test/java/com/codedifferently/lesson14/ecommerce/EcommerceSystemTest.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import org.junit.jupiter.api.Test;
88

99
class EcommerceSystemTest {
10+
1011
EcommerceSystem ecommerceSystem;
1112

1213
@BeforeEach
@@ -21,7 +22,7 @@ void testAddProduct() {
2122
}
2223

2324
@Test
24-
void testPlaceOrder() {
25+
void testPlaceOrder() throws Exception {
2526
// Arrange
2627
ecommerceSystem.addProduct("1", "Laptop");
2728

@@ -34,15 +35,15 @@ void testPlaceOrder() {
3435
}
3536

3637
@Test
37-
void testPlaceOrder_productDoesNotExist() {
38+
void testPlaceOrder_productDoesNotExist() throws Exception {
3839
// Act
3940
assertThatThrownBy(() -> ecommerceSystem.placeOrder("1", 1))
4041
.isInstanceOf(ProductNotFoundException.class)
4142
.hasMessage("Product with ID 1 not found");
4243
}
4344

4445
@Test
45-
void testCancelOrder() {
46+
void testCancelOrder() throws Exception {
4647
// Arrange
4748
ecommerceSystem.addProduct("1", "Laptop");
4849
String orderId = ecommerceSystem.placeOrder("1", 1);
@@ -60,7 +61,7 @@ void testCheckOrderStatus_orderDoesNotExist() {
6061
}
6162

6263
@Test
63-
void testCheckOrderStatus_orderCancelled() {
64+
void testCheckOrderStatus_orderCancelled() throws Exception {
6465
// Arrange
6566
ecommerceSystem.addProduct("1", "Laptop");
6667
String orderId = ecommerceSystem.placeOrder("1", 1);

0 commit comments

Comments
 (0)