diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2024-05-03 11:40:31 +0200 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2024-05-03 14:48:44 +0200 |
commit | 43be745547fcc827761a172136c3f3e9834f5544 (patch) | |
tree | ac0055706ac3a5a0df5af5512abdd1a6694157f7 /src/test/java/org/sonarsource/scanner/cli/LogsTest.java | |
parent | e7fc5ea5667ce260ad48d5603c262614bbed8222 (diff) | |
download | sonar-scanner-cli-43be745547fcc827761a172136c3f3e9834f5544.tar.gz sonar-scanner-cli-43be745547fcc827761a172136c3f3e9834f5544.zip |
Update tests to JUnit 5
Diffstat (limited to 'src/test/java/org/sonarsource/scanner/cli/LogsTest.java')
-rw-r--r-- | src/test/java/org/sonarsource/scanner/cli/LogsTest.java | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/test/java/org/sonarsource/scanner/cli/LogsTest.java b/src/test/java/org/sonarsource/scanner/cli/LogsTest.java index 82a26ad..1bb1abe 100644 --- a/src/test/java/org/sonarsource/scanner/cli/LogsTest.java +++ b/src/test/java/org/sonarsource/scanner/cli/LogsTest.java @@ -20,8 +20,8 @@ package org.sonarsource.scanner.cli; import java.io.PrintStream; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.MockitoAnnotations; @@ -32,7 +32,7 @@ import static org.mockito.Mockito.reset; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; -public class LogsTest { +class LogsTest { @Mock private PrintStream stdOut; @@ -41,28 +41,28 @@ public class LogsTest { private Logs logs; - @Before - public void setUp() { + @BeforeEach + void setUp() { MockitoAnnotations.initMocks(this); logs = new Logs(stdOut, stdErr); } @Test - public void testInfo() { + void testInfo() { logs.info("info"); verify(stdOut).println("INFO: info"); verifyNoMoreInteractions(stdOut, stdErr); } @Test - public void testWarn() { + void testWarn() { logs.warn("warn"); verify(stdOut).println("WARN: warn"); verifyNoMoreInteractions(stdOut, stdErr); } @Test - public void testWarnWithTimestamp() { + void testWarnWithTimestamp() { logs.setDebugEnabled(true); logs.warn("warn"); verify(stdOut).println(ArgumentMatchers.matches("\\d\\d:\\d\\d:\\d\\d.\\d\\d\\d WARN: warn")); @@ -70,7 +70,7 @@ public class LogsTest { } @Test - public void testError() { + void testError() { Exception e = new NullPointerException("exception"); logs.error("error1"); verify(stdErr).println("ERROR: error1"); @@ -82,7 +82,7 @@ public class LogsTest { } @Test - public void testDebug() { + void testDebug() { logs.setDebugEnabled(true); logs.debug("debug"); @@ -94,7 +94,7 @@ public class LogsTest { } @Test - public void should_forward_logs() { + void should_forward_logs() { var mockedLogs = mock(Logs.class); var logOutput = new Logs.LogOutputAdapter(mockedLogs); |