Skip to content

Commit 487c7f1

Browse files
committed
Added AutoClose junit example
1 parent 718612c commit 487c7f1

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,11 +375,13 @@ import static org.assertj.core.api.Assertions.assertThat;
375375

376376
import nl.altindag.log.LogCaptor;
377377
import org.junit.jupiter.api.AfterAll;
378+
import org.junit.jupiter.api.AutoClose;
378379
import org.junit.jupiter.api.BeforeAll;
379380
import org.junit.jupiter.api.Test;
380381

381382
public class FooServiceShould {
382383

384+
@AutoClose
383385
private static LogCaptor logCaptorForSomeOtherService = LogCaptor.forClass(SomeService.class);
384386

385387
@BeforeAll

src/test/java/nl/altindag/log/LogCaptorShould.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
import nl.altindag.log.service.slfj4.ServiceWithSlf4jAndMdcHeaders;
5151
import nl.altindag.log.service.slfj4.ServiceWithSlf4jWhileUsingKeyValuePairs;
5252
import org.junit.jupiter.api.AfterEach;
53+
import org.junit.jupiter.api.AutoClose;
5354
import org.junit.jupiter.api.Nested;
5455
import org.junit.jupiter.api.Test;
5556
import org.junit.jupiter.api.extension.ExtendWith;
@@ -86,6 +87,7 @@
8687
@ExtendWith(MockitoExtension.class)
8788
class LogCaptorShould {
8889

90+
@AutoClose
8991
private LogCaptor logCaptor;
9092

9193
@AfterEach

0 commit comments

Comments
 (0)