Skip to content

Commit 5d82e9b

Browse files
Update vanillajava/src/test/java/com/example/SimpleTest.java
Co-authored-by: Copilot <[email protected]>
1 parent c82ce3e commit 5d82e9b

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

vanillajava/src/test/java/com/example/SimpleTest.java

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,32 @@ public class SimpleTest {
1616
public static void main(String[] args) {
1717
SimpleTest test = new SimpleTest();
1818

19+
boolean allTestsPassed = true;
20+
21+
System.out.println("Starting Add to Cart test...");
1922
try {
20-
System.out.println("Starting Add to Cart test...");
2123
test.testAddToCartBStackDemo();
2224
System.out.println("Add to Cart test completed successfully!");
23-
24-
System.out.println("\nStarting Checkout Flow test...");
25+
} catch (Exception e) {
26+
System.err.println("Add to Cart test failed: " + e.getMessage());
27+
e.printStackTrace();
28+
allTestsPassed = false;
29+
}
30+
31+
System.out.println("\nStarting Checkout Flow test...");
32+
try {
2533
test.testCheckoutFlowBStackDemo();
2634
System.out.println("Checkout Flow test completed successfully!");
27-
28-
System.out.println("\nAll tests passed!");
2935
} catch (Exception e) {
30-
System.err.println("Test failed: " + e.getMessage());
36+
System.err.println("Checkout Flow test failed: " + e.getMessage());
3137
e.printStackTrace();
38+
allTestsPassed = false;
39+
}
40+
41+
if (allTestsPassed) {
42+
System.out.println("\nAll tests passed!");
43+
} else {
44+
System.err.println("\nOne or more tests failed.");
3245
System.exit(1);
3346
}
3447
}

0 commit comments

Comments
 (0)