mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-10-12 20:15:47 +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
@@ -73,6 +73,11 @@ public class Main {
|
||||
* @param args command line args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(Main.class, args);
|
||||
var context = SpringApplication.run(Main.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
@@ -32,6 +32,6 @@ import org.junit.jupiter.api.Test;
|
||||
class MainTest {
|
||||
@Test
|
||||
void shouldExecuteApplicationWithoutException() {
|
||||
assertDoesNotThrow(() -> Main.main(new String[] {}));
|
||||
assertDoesNotThrow(() -> Main.main(new String[] {"test"}));
|
||||
}
|
||||
}
|
||||
+6
-1
@@ -72,6 +72,11 @@ public class Main {
|
||||
* @param args command line args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(Main.class, args);
|
||||
var context = SpringApplication.run(Main.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
@@ -32,6 +32,6 @@ import org.junit.jupiter.api.Test;
|
||||
class MainTest {
|
||||
@Test
|
||||
void shouldExecuteApplicationWithoutException() {
|
||||
assertDoesNotThrow(() -> Main.main(new String[] {}));
|
||||
assertDoesNotThrow(() -> Main.main(new String[] {"test"}));
|
||||
}
|
||||
}
|
||||
+6
-1
@@ -72,6 +72,11 @@ public class Main {
|
||||
* @param args command line args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(Main.class, args);
|
||||
var context = SpringApplication.run(Main.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
@@ -33,6 +33,6 @@ import org.junit.jupiter.api.Test;
|
||||
class MainTest {
|
||||
@Test
|
||||
void shouldExecuteApplicationWithoutException() {
|
||||
assertDoesNotThrow(() -> Main.main(new String[] {}));
|
||||
assertDoesNotThrow(() -> Main.main(new String[] {"test"}));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user