mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-10-13 20:14:59 +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
+6
-1
@@ -45,7 +45,12 @@ import org.springframework.context.annotation.Bean;
|
||||
@Slf4j
|
||||
public class App {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(App.class, args);
|
||||
var context = SpringApplication.run(App.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();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ class AppTest {
|
||||
|
||||
@Test
|
||||
void testMain() {
|
||||
assertDoesNotThrow(() -> App.main(new String[] {}));
|
||||
assertDoesNotThrow(() -> App.main(new String[] {"test"}));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in new issue
Block a user