11/*
2- * Copyright 2009-2023 the original author or authors.
2+ * Copyright 2009-2024 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
1818import java .io .Reader ;
1919import java .util .concurrent .ExecutorService ;
2020import java .util .concurrent .Executors ;
21+ import java .util .concurrent .TimeUnit ;
2122
2223import org .apache .ibatis .BaseDataTest ;
2324import org .apache .ibatis .io .Resources ;
2425import org .apache .ibatis .session .SqlSession ;
2526import org .apache .ibatis .session .SqlSessionFactory ;
2627import org .apache .ibatis .session .SqlSessionFactoryBuilder ;
27- import org .junit . jupiter .api .Assertions ;
28+ import org .assertj . core .api .Assertions ;
2829import org .junit .jupiter .api .BeforeEach ;
2930import org .junit .jupiter .api .Test ;
3031
@@ -47,7 +48,7 @@ void setUp() throws Exception {
4748 }
4849
4950 @ Test
50- void testBlockingCache () {
51+ void testBlockingCache () throws InterruptedException {
5152 ExecutorService defaultThreadPool = Executors .newFixedThreadPool (2 );
5253
5354 long init = System .currentTimeMillis ();
@@ -57,13 +58,12 @@ void testBlockingCache() {
5758 }
5859
5960 defaultThreadPool .shutdown ();
60-
61- while (!defaultThreadPool .isTerminated ()) {
62- continue ;
61+ if (!defaultThreadPool .awaitTermination (5 , TimeUnit .SECONDS )) {
62+ defaultThreadPool .shutdownNow ();
6363 }
6464
6565 long totalTime = System .currentTimeMillis () - init ;
66- Assertions .assertTrue (totalTime > 1000 );
66+ Assertions .assertThat (totalTime ). isGreaterThanOrEqualTo ( 1000 );
6767 }
6868
6969 private void accessDB () {
0 commit comments