From: Simon Brandhof Date: Tue, 17 Mar 2020 12:15:21 +0000 (+0100) Subject: SONAR-13155 upgrade testing dependencies X-Git-Tag: 8.3.0.34182~110 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=213d390cba59b7590f940cb4245d0e3a77cb2964;p=sonarqube.git SONAR-13155 upgrade testing dependencies --- diff --git a/build.gradle b/build.gradle index e0cd60167b6..4002f46fc01 100644 --- a/build.gradle +++ b/build.gradle @@ -208,17 +208,17 @@ subprojects { entry 'okhttp' entry 'mockwebserver' } - dependency 'com.tngtech.java:junit-dataprovider:1.9.2' + dependency 'com.tngtech.java:junit-dataprovider:1.13.1' dependency 'info.picocli:picocli:3.6.1' dependency "io.jsonwebtoken:jjwt-api:${jjwtVersion}" dependency "io.jsonwebtoken:jjwt-impl:${jjwtVersion}" dependency "io.jsonwebtoken:jjwt-jackson:${jjwtVersion}" - dependency 'io.netty:netty-all:4.0.51.Final' + dependency 'io.netty:netty-all:4.1.48.Final' dependency 'com.sun.mail:javax.mail:1.5.6' dependency 'javax.annotation:javax.annotation-api:1.3.1' dependency 'javax.servlet:javax.servlet-api:3.1.0' dependency 'javax.xml.bind:jaxb-api:2.3.0' - dependency 'junit:junit:4.12' + dependency 'junit:junit:4.13' dependency 'org.junit.jupiter:junit-jupiter-api:5.5.2' dependency 'net.jpountz.lz4:lz4:1.3.0' dependency 'net.lightbody.bmp:littleproxy:1.1.0-beta-bmp-17' @@ -279,7 +279,7 @@ subprojects { dependency 'org.hamcrest:hamcrest-all:1.3' dependency 'org.jsoup:jsoup:1.12.1' dependency 'org.mindrot:jbcrypt:0.4' - dependency('org.mockito:mockito-core:3.1.0') { + dependency('org.mockito:mockito-core:3.3.3') { exclude 'org.hamcrest:hamcrest-core' } dependency 'org.mybatis:mybatis:3.5.4' diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/ce/ws/SubmitActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/ce/ws/SubmitActionTest.java index 1a55827fb7d..8fce2030533 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/ce/ws/SubmitActionTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/ce/ws/SubmitActionTest.java @@ -22,11 +22,8 @@ package org.sonar.server.ce.ws; import com.google.common.base.Strings; import java.io.ByteArrayInputStream; import java.util.Map; -import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.mockito.MockitoAnnotations; import org.sonar.ce.task.CeTask; import org.sonar.db.ce.CeTaskTypes; import org.sonar.server.ce.queue.ReportSubmitter; @@ -61,20 +58,13 @@ public class SubmitActionTest { .setSubmitter(new CeTask.User("UUID_1", "LOGIN_1")) .build(); - @Captor - ArgumentCaptor> map; - + private ArgumentCaptor> map = ArgumentCaptor.forClass(Map.class); private DefaultOrganizationProvider defaultOrganizationProvider = TestDefaultOrganizationProvider.fromUuid("org1"); private String organizationKey = defaultOrganizationProvider.get().getKey(); private ReportSubmitter reportSubmitter = mock(ReportSubmitter.class); private SubmitAction underTest = new SubmitAction(reportSubmitter, defaultOrganizationProvider); private WsActionTester tester = new WsActionTester(underTest); - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - @Test public void submit_task_to_the_queue_and_ask_for_immediate_processing() { when(reportSubmitter.submit(eq(organizationKey), eq("my_project"), eq("My Project"), anyMap(), any())).thenReturn(A_CE_TASK); diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/ActivateRuleActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/ActivateRuleActionTest.java index 28f385073b9..70393d1c13b 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/ActivateRuleActionTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/ActivateRuleActionTest.java @@ -26,7 +26,6 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.mockito.ArgumentCaptor; -import org.mockito.Captor; import org.mockito.MockitoAnnotations; import org.sonar.api.rule.RuleKey; import org.sonar.api.rule.Severity; @@ -69,9 +68,8 @@ public class ActivateRuleActionTest { public UserSessionRule userSession = UserSessionRule.standalone(); @Rule public ExpectedException expectedException = ExpectedException.none(); - @Captor - public ArgumentCaptor> ruleActivationCaptor; + private ArgumentCaptor> ruleActivationCaptor = ArgumentCaptor.forClass(Collection.class); private DbClient dbClient = db.getDbClient(); private QProfileRules qProfileRules = mock(QProfileRules.class); private QProfileWsSupport wsSupport = new QProfileWsSupport(dbClient, userSession, TestDefaultOrganizationProvider.from(db)); diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/DeactivateRuleActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/DeactivateRuleActionTest.java index de5d33114f5..cbdcb172812 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/DeactivateRuleActionTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/DeactivateRuleActionTest.java @@ -26,7 +26,6 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.mockito.ArgumentCaptor; -import org.mockito.Captor; import org.mockito.MockitoAnnotations; import org.sonar.api.rule.RuleKey; import org.sonar.api.server.ws.WebService; @@ -67,9 +66,8 @@ public class DeactivateRuleActionTest { public UserSessionRule userSession = UserSessionRule.standalone(); @Rule public ExpectedException expectedException = ExpectedException.none(); - @Captor - public ArgumentCaptor> ruleIdsCaptor; + private ArgumentCaptor> ruleIdsCaptor = ArgumentCaptor.forClass(Collection.class); private DbClient dbClient = db.getDbClient(); private QProfileRules qProfileRules = mock(QProfileRules.class); private QProfileWsSupport wsSupport = new QProfileWsSupport(dbClient, userSession, TestDefaultOrganizationProvider.from(db)); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/JavaCpdBlockIndexerSensorTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/JavaCpdBlockIndexerSensorTest.java index 453c50776e9..9c5f9be1702 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/JavaCpdBlockIndexerSensorTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/JavaCpdBlockIndexerSensorTest.java @@ -29,14 +29,13 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; import org.mockito.ArgumentCaptor; -import org.mockito.Captor; import org.mockito.Mock; import org.mockito.MockitoAnnotations; -import org.sonar.duplications.block.Block; -import org.sonar.scanner.cpd.index.SonarCpdBlockIndex; import org.sonar.api.batch.fs.internal.DefaultInputFile; import org.sonar.api.batch.fs.internal.TestInputFileBuilder; import org.sonar.api.batch.sensor.internal.SensorContextTester; +import org.sonar.duplications.block.Block; +import org.sonar.scanner.cpd.index.SonarCpdBlockIndex; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.eq; @@ -53,9 +52,7 @@ public class JavaCpdBlockIndexerSensorTest { @Mock private SonarCpdBlockIndex index; - @Captor - private ArgumentCaptor> blockCaptor; - + private ArgumentCaptor> blockCaptor = ArgumentCaptor.forClass(List.class); private DefaultInputFile file; @Before diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/branch/BranchConfigurationProviderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/branch/BranchConfigurationProviderTest.java index 13ce54c130f..143278fa377 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/branch/BranchConfigurationProviderTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/branch/BranchConfigurationProviderTest.java @@ -21,11 +21,8 @@ package org.sonar.scanner.scan.branch; import java.util.HashMap; import java.util.Map; -import java.util.function.Supplier; import org.junit.Before; import org.junit.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; import org.mockito.MockitoAnnotations; import org.sonar.api.batch.bootstrap.ProjectDefinition; import org.sonar.api.batch.bootstrap.ProjectReactor; @@ -47,9 +44,6 @@ public class BranchConfigurationProviderTest { private Map projectSettings = new HashMap<>(); private ProjectDefinition root = mock(ProjectDefinition.class); - @Captor - private ArgumentCaptor>> settingsCaptor; - @Before public void setUp() { MockitoAnnotations.initMocks(this); diff --git a/sonar-testing-ldap/build.gradle b/sonar-testing-ldap/build.gradle index 4a2fe9a4ad7..8f82987689f 100644 --- a/sonar-testing-ldap/build.gradle +++ b/sonar-testing-ldap/build.gradle @@ -7,7 +7,7 @@ sonarqube { dependencies { compile 'junit:junit' compile 'org.apache.directory.server:apacheds-all:2.0.0-M24' - compile 'org.slf4j:slf4j-api:1.7.12' + compile 'org.slf4j:slf4j-api' testCompile 'org.assertj:assertj-core' testCompile 'org.hamcrest:hamcrest-core'