Skip to content

Commit

Permalink
fix: updates build config and adjusts tests (code-differently#460)
Browse files Browse the repository at this point in the history
Signed-off-by: Anthony D. Mays <[email protected]>
  • Loading branch information
anthonydmays authored Oct 27, 2024
1 parent 4a2cb00 commit 6185a38
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lesson_13/maps_java/maps_app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ dependencies {

application {
// Define the main class for the application.
mainClass.set("com.codedifferently.lesson12.Lesson12")
mainClass.set("com.codedifferently.lesson13.Lesson13")
}

tasks.named<Test>("test") {
Expand Down
2 changes: 1 addition & 1 deletion lesson_14/exceptions/exceptions_app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ dependencies {

application {
// Define the main class for the application.
mainClass.set("com.codedifferently.lesson12.Lesson12")
mainClass.set("com.codedifferently.lesson14.Lesson14")
}

tasks.named<Test>("test") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ void testPlaceOrder_productDoesNotExist() throws Exception {
assertThatThrownBy(() -> ecommerceSystem.placeOrder("1", 1))
.isInstanceOf(ProductNotFoundException.class)
.hasMessage("Product with ID 1 not found");

// Act
assertThatThrownBy(() -> ecommerceSystem.placeOrder("34", 1))
.isInstanceOf(ProductNotFoundException.class)
.hasMessage("Product with ID 34 not found");
}

@Test
Expand All @@ -58,18 +63,23 @@ void testCheckOrderStatus_orderDoesNotExist() {
assertThatThrownBy(() -> ecommerceSystem.checkOrderStatus("1"))
.isInstanceOf(OrderNotFoundException.class)
.hasMessage("Order with ID 1 not found");

// Act
assertThatThrownBy(() -> ecommerceSystem.checkOrderStatus("33"))
.isInstanceOf(OrderNotFoundException.class)
.hasMessage("Order with ID 33 not found");
}

@Test
void testCheckOrderStatus_orderCancelled() throws Exception {
// Arrange
ecommerceSystem.addProduct("1", "Laptop");
String orderId = ecommerceSystem.placeOrder("1", 1);
ecommerceSystem.addProduct("58", "Laptop");
String orderId = ecommerceSystem.placeOrder("58", 1);
ecommerceSystem.cancelOrder(orderId);

// Act
assertThatThrownBy(() -> ecommerceSystem.checkOrderStatus("1"))
assertThatThrownBy(() -> ecommerceSystem.checkOrderStatus("58"))
.isInstanceOf(OrderNotFoundException.class)
.hasMessage("Order with ID 1 not found");
.hasMessage("Order with ID 58 not found");
}
}

0 comments on commit 6185a38

Please sign in to comment.