mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-10-12 22:14:41 +00:00
fix: Fix test stability issues
This commit is contained in:
1 parent
13cde46f2e
commit
177dc52704
24 files changed
+253
-111
No files matched your search
@@ -67,7 +67,12 @@ public class SingleTableInheritance implements CommandLineRunner {
|
||||
* @param args program runtime arguments
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(SingleTableInheritance.class, args);
|
||||
var context = SpringApplication.run(SingleTableInheritance.class, args);
|
||||
if (args.length > 0 && "test".equals(args[0])) {
|
||||
// Close the context immediately during tests to prevent Tomcat/background threads from
|
||||
// hanging the JVM
|
||||
context.close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -33,6 +33,6 @@ class SingleTableInheritanceTest {
|
||||
|
||||
@Test
|
||||
void shouldExecuteWithoutException() {
|
||||
assertDoesNotThrow(() -> SingleTableInheritance.main(new String[] {}));
|
||||
assertDoesNotThrow(() -> SingleTableInheritance.main(new String[] {"test"}));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user