Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: updates build config and adjusts tests #460

Merged
merged 1 commit into from
Oct 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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");
}
}
Loading