@@ -23,7 +23,16 @@ dependencies { | |||
testImplementation 'com.tngtech.java:junit-dataprovider' | |||
testImplementation 'junit:junit' | |||
testImplementation 'org.assertj:assertj-core' | |||
testImplementation 'org.junit.jupiter:junit-jupiter-api' | |||
testImplementation 'org.mockito:mockito-core' | |||
testImplementation testFixtures(project(':server:sonar-db-dao')) | |||
testImplementation project(path: ':server:sonar-webserver-api') | |||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' | |||
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine' | |||
} | |||
test { | |||
// Enabling the JUnit Platform (see https://github.com/junit-team/junit5-samples/tree/master/junit5-migration-gradle) | |||
useJUnitPlatform() | |||
} |
@@ -20,7 +20,16 @@ dependencies { | |||
testImplementation 'com.tngtech.java:junit-dataprovider' | |||
testImplementation 'junit:junit' | |||
testImplementation 'org.assertj:assertj-core' | |||
testImplementation 'org.junit.jupiter:junit-jupiter-api' | |||
testImplementation 'org.mockito:mockito-core' | |||
testImplementation 'org.sonarsource.api.plugin:sonar-plugin-api-test-fixtures' | |||
testImplementation testFixtures(project(':server:sonar-db-dao')) | |||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' | |||
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine' | |||
} | |||
test { | |||
// Enabling the JUnit Platform (see https://github.com/junit-team/junit5-samples/tree/master/junit5-migration-gradle) | |||
useJUnitPlatform() | |||
} |
@@ -50,7 +50,16 @@ dependencies { | |||
testImplementation 'org.assertj:assertj-core' | |||
testImplementation 'org.assertj:assertj-guava' | |||
testImplementation 'org.hamcrest:hamcrest-all' | |||
testImplementation 'org.junit.jupiter:junit-jupiter-api' | |||
testImplementation 'org.mockito:mockito-core' | |||
testImplementation project(':sonar-plugin-api-impl') | |||
testImplementation testFixtures(project(':server:sonar-server-common')) | |||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' | |||
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine' | |||
} | |||
test { | |||
// Enabling the JUnit Platform (see https://github.com/junit-team/junit5-samples/tree/master/junit5-migration-gradle) | |||
useJUnitPlatform() | |||
} |
@@ -51,6 +51,7 @@ dependencies { | |||
testImplementation 'org.apache.logging.log4j:log4j-core' | |||
testImplementation 'org.assertj:assertj-core' | |||
testImplementation 'org.assertj:assertj-guava' | |||
testImplementation 'org.junit.jupiter:junit-jupiter-api' | |||
testImplementation 'org.reflections:reflections' | |||
testImplementation 'org.sonarsource.api.plugin:sonar-plugin-api-test-fixtures' | |||
testImplementation project(':sonar-testing-harness') | |||
@@ -63,4 +64,11 @@ dependencies { | |||
testFixturesCompileOnly 'com.google.code.findbugs:jsr305' | |||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' | |||
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine' | |||
} | |||
test { | |||
// Enabling the JUnit Platform (see https://github.com/junit-team/junit5-samples/tree/master/junit5-migration-gradle) | |||
useJUnitPlatform() | |||
} |
@@ -36,6 +36,7 @@ dependencies { | |||
testImplementation 'org.apache.logging.log4j:log4j-api' | |||
testImplementation 'org.apache.logging.log4j:log4j-core' | |||
testImplementation 'org.assertj:assertj-guava' | |||
testImplementation 'org.junit.jupiter:junit-jupiter-api' | |||
testImplementation 'org.mockito:mockito-core' | |||
testImplementation 'org.reflections:reflections' | |||
testImplementation 'org.sonarsource.api.plugin:sonar-plugin-api-test-fixtures' | |||
@@ -44,4 +45,12 @@ dependencies { | |||
testFixturesApi 'org.assertj:assertj-core' | |||
testFixturesCompileOnly 'com.google.code.findbugs:jsr305' | |||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' | |||
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine' | |||
} | |||
test { | |||
// Enabling the JUnit Platform (see https://github.com/junit-team/junit5-samples/tree/master/junit5-migration-gradle) | |||
useJUnitPlatform() | |||
} |
@@ -31,10 +31,18 @@ dependencies { | |||
testImplementation 'junit:junit' | |||
testImplementation 'org.assertj:assertj-core' | |||
testImplementation 'org.awaitility:awaitility' | |||
testImplementation 'org.junit.jupiter:junit-jupiter-api' | |||
testImplementation 'org.mockito:mockito-core' | |||
testImplementation 'org.slf4j:slf4j-api' | |||
testImplementation 'org.sonarsource.api.plugin:sonar-plugin-api-test-fixtures' | |||
testImplementation testFixtures(project(':server:sonar-db-dao')) | |||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' | |||
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine' | |||
} | |||
test { | |||
// Enabling the JUnit Platform (see https://github.com/junit-team/junit5-samples/tree/master/junit5-migration-gradle) | |||
useJUnitPlatform() | |||
} |
@@ -35,6 +35,8 @@ dependencies { | |||
testCompileOnly 'com.google.code.findbugs:jsr305' | |||
testRuntimeOnly 'com.h2database:h2' | |||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' | |||
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine' | |||
testRuntimeOnly 'com.microsoft.sqlserver:mssql-jdbc' | |||
testRuntimeOnly 'com.oracle.database.jdbc:ojdbc11' | |||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' |
@@ -39,6 +39,7 @@ dependencies { | |||
testImplementation 'org.apache.logging.log4j:log4j-core' | |||
testImplementation 'org.assertj:assertj-core' | |||
testImplementation 'org.hamcrest:hamcrest-core' | |||
testImplementation 'org.junit.jupiter:junit-jupiter-api' | |||
testImplementation 'org.mockito:mockito-core' | |||
testImplementation 'org.sonarsource.api.plugin:sonar-plugin-api-test-fixtures' | |||
testImplementation testFixtures(project(':server:sonar-db-dao')) | |||
@@ -55,4 +56,13 @@ dependencies { | |||
testFixturesImplementation 'org.codelibs.elasticsearch.module:analysis-common' | |||
testFixturesImplementation 'org.codelibs.elasticsearch.module:reindex' | |||
testFixturesImplementation 'org.elasticsearch:mocksocket' | |||
testFixturesImplementation 'org.junit.jupiter:junit-jupiter-api' | |||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' | |||
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine' | |||
} | |||
test { | |||
// Enabling the JUnit Platform (see https://github.com/junit-team/junit5-samples/tree/master/junit5-migration-gradle) | |||
useJUnitPlatform() | |||
} |
@@ -34,6 +34,7 @@ dependencies { | |||
testImplementation 'com.google.code.findbugs:jsr305' | |||
testImplementation 'com.tngtech.java:junit-dataprovider' | |||
testImplementation 'javax.servlet:javax.servlet-api' | |||
testImplementation 'org.junit.jupiter:junit-jupiter-api' | |||
testImplementation 'org.mockito:mockito-core' | |||
testImplementation 'org.sonarsource.api.plugin:sonar-plugin-api-test-fixtures' | |||
testImplementation testFixtures(project(':server:sonar-server-common')) | |||
@@ -42,4 +43,12 @@ dependencies { | |||
testFixturesApi 'junit:junit' | |||
testFixturesCompileOnly 'com.google.code.findbugs:jsr305' | |||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' | |||
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine' | |||
} | |||
test { | |||
// Enabling the JUnit Platform (see https://github.com/junit-team/junit5-samples/tree/master/junit5-migration-gradle) | |||
useJUnitPlatform() | |||
} |
@@ -28,6 +28,7 @@ dependencies { | |||
testImplementation 'org.apache.logging.log4j:log4j-api' | |||
testImplementation 'org.apache.logging.log4j:log4j-core' | |||
testImplementation 'org.assertj:assertj-guava' | |||
testImplementation 'org.junit.jupiter:junit-jupiter-api' | |||
testImplementation 'org.mockito:mockito-core' | |||
testImplementation 'org.sonarsource.api.plugin:sonar-plugin-api-test-fixtures' | |||
testImplementation testFixtures(project(':server:sonar-server-common')) | |||
@@ -40,4 +41,13 @@ dependencies { | |||
testFixturesApi 'junit:junit' | |||
testFixturesCompileOnly 'com.google.code.findbugs:jsr305' | |||
testFixturesCompileOnly 'org.junit.jupiter:junit-jupiter-api' | |||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' | |||
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine' | |||
} | |||
test { | |||
// Enabling the JUnit Platform (see https://github.com/junit-team/junit5-samples/tree/master/junit5-migration-gradle) | |||
useJUnitPlatform() | |||
} |
@@ -25,6 +25,9 @@ import java.util.List; | |||
import java.util.Optional; | |||
import javax.annotation.CheckForNull; | |||
import javax.annotation.Nullable; | |||
import org.junit.jupiter.api.extension.AfterTestExecutionCallback; | |||
import org.junit.jupiter.api.extension.BeforeTestExecutionCallback; | |||
import org.junit.jupiter.api.extension.ExtensionContext; | |||
import org.junit.rules.TestRule; | |||
import org.junit.runner.Description; | |||
import org.junit.runners.model.Statement; | |||
@@ -78,7 +81,7 @@ import static com.google.common.base.Preconditions.checkState; | |||
* (use the latest override if you don't care about the actual value of the login, it will save noise in your test). | |||
* </p> | |||
*/ | |||
public class UserSessionRule implements TestRule, UserSession { | |||
public class UserSessionRule implements TestRule, UserSession, BeforeTestExecutionCallback, AfterTestExecutionCallback { | |||
private static final String DEFAULT_LOGIN = "default_login"; | |||
private AbstractMockUserSession<?> currentUserSession; | |||
@@ -170,6 +173,16 @@ public class UserSessionRule implements TestRule, UserSession { | |||
this.currentUserSession = null; | |||
} | |||
@Override | |||
public void beforeTestExecution(ExtensionContext context) { | |||
before(); | |||
} | |||
@Override | |||
public void afterTestExecution(ExtensionContext context) { | |||
after(); | |||
} | |||
public void set(AbstractMockUserSession<?> userSession) { | |||
checkNotNull(userSession); | |||
setCurrentUserSession(userSession); |
@@ -24,10 +24,19 @@ dependencies { | |||
testImplementation 'junit:junit' | |||
testImplementation 'org.assertj:assertj-core' | |||
testImplementation 'org.junit.jupiter:junit-jupiter-api' | |||
testImplementation 'org.mockito:mockito-core' | |||
testImplementation project(':sonar-testing-harness') | |||
testImplementation testFixtures(project(':server:sonar-db-dao')) | |||
testImplementation testFixtures(project(':server:sonar-server-common')) | |||
testImplementation testFixtures(project(':server:sonar-webserver-api')) | |||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' | |||
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine' | |||
} | |||
test { | |||
// Enabling the JUnit Platform (see https://github.com/junit-team/junit5-samples/tree/master/junit5-migration-gradle) | |||
useJUnitPlatform() | |||
} |
@@ -68,6 +68,7 @@ dependencies { | |||
testImplementation 'org.eclipse.jetty:jetty-server' | |||
testImplementation 'org.eclipse.jetty:jetty-servlet' | |||
testImplementation 'org.hamcrest:hamcrest-all' | |||
testImplementation 'org.junit.jupiter:junit-jupiter-api' | |||
testImplementation 'org.mockito:mockito-core' | |||
testImplementation 'org.sonarsource.api.plugin:sonar-plugin-api-test-fixtures' | |||
testImplementation 'org.subethamail:subethasmtp' | |||
@@ -77,5 +78,13 @@ dependencies { | |||
testImplementation testFixtures(project(':server:sonar-webserver-ws')) | |||
testImplementation project(':sonar-testing-harness') | |||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' | |||
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine' | |||
runtimeOnly 'io.jsonwebtoken:jjwt-jackson' | |||
} | |||
test { | |||
// Enabling the JUnit Platform (see https://github.com/junit-team/junit5-samples/tree/master/junit5-migration-gradle) | |||
useJUnitPlatform() | |||
} |
@@ -20,10 +20,19 @@ dependencies { | |||
testImplementation 'org.assertj:assertj-guava' | |||
testImplementation 'com.google.code.findbugs:jsr305' | |||
testImplementation 'com.tngtech.java:junit-dataprovider' | |||
testImplementation 'org.junit.jupiter:junit-jupiter-api' | |||
testImplementation 'org.mockito:mockito-core' | |||
testImplementation 'org.sonarsource.api.plugin:sonar-plugin-api-test-fixtures' | |||
testImplementation testFixtures(project(':server:sonar-webserver-auth')) | |||
testImplementation project(':sonar-testing-harness') | |||
testFixturesApi testFixtures(project(':server:sonar-server-common')) | |||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' | |||
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine' | |||
} | |||
test { | |||
// Enabling the JUnit Platform (see https://github.com/junit-team/junit5-samples/tree/master/junit5-migration-gradle) | |||
useJUnitPlatform() | |||
} |
@@ -13,6 +13,7 @@ dependencies { | |||
testImplementation 'junit:junit' | |||
testImplementation 'org.assertj:assertj-core' | |||
testImplementation 'org.junit.jupiter:junit-jupiter-api' | |||
testImplementation 'org.mockito:mockito-core' | |||
testImplementation 'org.awaitility:awaitility' | |||
testImplementation testFixtures(project(':server:sonar-webserver-ws')) | |||
@@ -20,4 +21,12 @@ dependencies { | |||
testFixturesApi project(':sonar-testing-harness') | |||
testFixturesCompileOnly testFixtures(project(':server:sonar-webserver-ws')) | |||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' | |||
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine' | |||
} | |||
test { | |||
// Enabling the JUnit Platform (see https://github.com/junit-team/junit5-samples/tree/master/junit5-migration-gradle) | |||
useJUnitPlatform() | |||
} |
@@ -16,6 +16,7 @@ dependencies { | |||
api project(':server:sonar-webserver-common') | |||
testImplementation 'javax.servlet:javax.servlet-api' | |||
testImplementation 'org.junit.jupiter:junit-jupiter-api' | |||
testImplementation 'org.mockito:mockito-core' | |||
testImplementation 'org.skyscreamer:jsonassert:1.5.1' | |||
testImplementation 'org.sonarsource.api.plugin:sonar-plugin-api-test-fixtures' | |||
@@ -28,5 +29,11 @@ dependencies { | |||
testFixturesApi 'org.springframework:spring-test' | |||
testRuntimeOnly 'org.apache.logging.log4j:log4j-core' | |||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' | |||
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine' | |||
} | |||
test { | |||
// Enabling the JUnit Platform (see https://github.com/junit-team/junit5-samples/tree/master/junit5-migration-gradle) | |||
useJUnitPlatform() | |||
} |
@@ -51,11 +51,12 @@ dependencies { | |||
testImplementation project(':sonar-testing-harness') | |||
testFixturesApi testFixtures(project(':server:sonar-db-dao')) | |||
testFixturesImplementation 'org.junit.jupiter:junit-jupiter-api' | |||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' | |||
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine' | |||
test { | |||
// Enabling the JUnit Platform (see https://github.com/junit-team/junit5-samples/tree/master/junit5-migration-gradle) | |||
useJUnitPlatform() | |||
} | |||
} | |||
test { | |||
// Enabling the JUnit Platform (see https://github.com/junit-team/junit5-samples/tree/master/junit5-migration-gradle) | |||
useJUnitPlatform() | |||
} |
@@ -20,8 +20,8 @@ | |||
package org.sonar.server.notification.ws; | |||
import javax.annotation.Nullable; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.junit.jupiter.api.Test; | |||
import org.junit.jupiter.api.extension.RegisterExtension; | |||
import org.sonar.api.notifications.Notification; | |||
import org.sonar.db.DbClient; | |||
import org.sonar.db.DbTester; | |||
@@ -56,15 +56,15 @@ import static org.sonar.server.notification.ws.NotificationsWsParameters.PARAM_L | |||
import static org.sonar.server.notification.ws.NotificationsWsParameters.PARAM_PROJECT; | |||
import static org.sonar.server.notification.ws.NotificationsWsParameters.PARAM_TYPE; | |||
public class AddActionIT { | |||
class AddActionIT { | |||
private static final String NOTIF_MY_NEW_ISSUES = "Dispatcher1"; | |||
private static final String NOTIF_NEW_ISSUES = "Dispatcher2"; | |||
private static final String NOTIF_NEW_QUALITY_GATE_STATUS = "Dispatcher3"; | |||
@Rule | |||
public UserSessionRule userSession = UserSessionRule.standalone(); | |||
@Rule | |||
public DbTester db = DbTester.create(); | |||
@RegisterExtension | |||
private final UserSessionRule userSession = UserSessionRule.standalone(); | |||
@RegisterExtension | |||
private final DbTester db = DbTester.create(); | |||
private final DbClient dbClient = db.getDbClient(); | |||
@@ -81,7 +81,7 @@ public class AddActionIT { | |||
new NotificationUpdater(dbClient), dispatchers, dbClient, TestComponentFinder.from(db), userSession)); | |||
@Test | |||
public void add_to_email_channel_by_default() { | |||
void add_to_email_channel_by_default() { | |||
UserDto user = db.users().insertUser(); | |||
userSession.logIn(user); | |||
when(dispatchers.getGlobalDispatchers()).thenReturn(singletonList(NOTIF_MY_NEW_ISSUES)); | |||
@@ -92,7 +92,7 @@ public class AddActionIT { | |||
} | |||
@Test | |||
public void add_to_a_specific_channel() { | |||
void add_to_a_specific_channel() { | |||
UserDto user = db.users().insertUser(); | |||
userSession.logIn(user); | |||
when(dispatchers.getGlobalDispatchers()).thenReturn(asList(NOTIF_MY_NEW_ISSUES, NOTIF_NEW_QUALITY_GATE_STATUS)); | |||
@@ -103,7 +103,7 @@ public class AddActionIT { | |||
} | |||
@Test | |||
public void add_notification_on_private_with_USER_permission() { | |||
void add_notification_on_private_with_USER_permission() { | |||
UserDto user = db.users().insertUser(); | |||
userSession.logIn(user); | |||
ProjectDto project = db.components().insertPrivateProject().getProjectDto(); | |||
@@ -117,7 +117,7 @@ public class AddActionIT { | |||
} | |||
@Test | |||
public void add_notification_on_public_project() { | |||
void add_notification_on_public_project() { | |||
UserDto user = db.users().insertUser(); | |||
userSession.logIn(user); | |||
ProjectDto project = db.components().insertPublicProject().getProjectDto(); | |||
@@ -131,7 +131,7 @@ public class AddActionIT { | |||
} | |||
@Test | |||
public void add_a_global_notification_when_a_project_one_exists() { | |||
void add_a_global_notification_when_a_project_one_exists() { | |||
UserDto user = db.users().insertUser(); | |||
userSession.logIn(user); | |||
when(dispatchers.getGlobalDispatchers()).thenReturn(singletonList(NOTIF_MY_NEW_ISSUES)); | |||
@@ -147,7 +147,7 @@ public class AddActionIT { | |||
} | |||
@Test | |||
public void add_a_notification_on_private_project_when_a_global_one_exists() { | |||
void add_a_notification_on_private_project_when_a_global_one_exists() { | |||
UserDto user = db.users().insertUser(); | |||
userSession.logIn(user); | |||
when(dispatchers.getGlobalDispatchers()).thenReturn(singletonList(NOTIF_MY_NEW_ISSUES)); | |||
@@ -163,7 +163,7 @@ public class AddActionIT { | |||
} | |||
@Test | |||
public void add_a_notification_on_public_project_when_a_global_one_exists() { | |||
void add_a_notification_on_public_project_when_a_global_one_exists() { | |||
UserDto user = db.users().insertUser(); | |||
userSession.logIn(user); | |||
when(dispatchers.getGlobalDispatchers()).thenReturn(singletonList(NOTIF_MY_NEW_ISSUES)); | |||
@@ -179,7 +179,7 @@ public class AddActionIT { | |||
} | |||
@Test | |||
public void http_no_content() { | |||
void http_no_content() { | |||
UserDto user = db.users().insertUser(); | |||
userSession.logIn(user); | |||
when(dispatchers.getGlobalDispatchers()).thenReturn(singletonList(NOTIF_MY_NEW_ISSUES)); | |||
@@ -190,7 +190,7 @@ public class AddActionIT { | |||
} | |||
@Test | |||
public void add_a_notification_to_a_user_as_system_administrator() { | |||
void add_a_notification_to_a_user_as_system_administrator() { | |||
UserDto user = db.users().insertUser(); | |||
userSession.logIn(user).setSystemAdministrator(); | |||
when(dispatchers.getGlobalDispatchers()).thenReturn(singletonList(NOTIF_MY_NEW_ISSUES)); | |||
@@ -201,7 +201,7 @@ public class AddActionIT { | |||
} | |||
@Test | |||
public void fail_if_login_is_provided_and_unknown() { | |||
void fail_if_login_is_provided_and_unknown() { | |||
UserDto user = db.users().insertUser(); | |||
userSession.logIn(user).setSystemAdministrator(); | |||
when(dispatchers.getGlobalDispatchers()).thenReturn(singletonList(NOTIF_MY_NEW_ISSUES)); | |||
@@ -212,7 +212,7 @@ public class AddActionIT { | |||
} | |||
@Test | |||
public void fail_if_login_provided_and_not_system_administrator() { | |||
void fail_if_login_provided_and_not_system_administrator() { | |||
UserDto user = db.users().insertUser(); | |||
userSession.logIn(user).setNonSystemAdministrator(); | |||
when(dispatchers.getGlobalDispatchers()).thenReturn(singletonList(NOTIF_MY_NEW_ISSUES)); | |||
@@ -223,7 +223,7 @@ public class AddActionIT { | |||
} | |||
@Test | |||
public void fail_if_project_provided_and_not_project_user() { | |||
void fail_if_project_provided_and_not_project_user() { | |||
ProjectDto project = db.components().insertPrivateProject().getProjectDto(); | |||
UserDto user = db.users().insertUser(); | |||
userSession.logIn(user); | |||
@@ -235,7 +235,7 @@ public class AddActionIT { | |||
} | |||
@Test | |||
public void fail_when_notification_already_exists() { | |||
void fail_when_notification_already_exists() { | |||
UserDto user = db.users().insertUser(); | |||
userSession.logIn(user); | |||
when(dispatchers.getGlobalDispatchers()).thenReturn(singletonList(NOTIF_MY_NEW_ISSUES)); | |||
@@ -247,13 +247,13 @@ public class AddActionIT { | |||
} | |||
@Test | |||
public void fail_when_unknown_channel() { | |||
void fail_when_unknown_channel() { | |||
assertThatThrownBy(() -> call(NOTIF_MY_NEW_ISSUES, "Channel42", null, null)) | |||
.isInstanceOf(IllegalArgumentException.class); | |||
} | |||
@Test | |||
public void fail_when_unknown_global_dispatcher() { | |||
void fail_when_unknown_global_dispatcher() { | |||
UserDto user = db.users().insertUser(); | |||
userSession.logIn(user); | |||
when(dispatchers.getGlobalDispatchers()).thenReturn(singletonList(NOTIF_MY_NEW_ISSUES)); | |||
@@ -264,7 +264,7 @@ public class AddActionIT { | |||
} | |||
@Test | |||
public void fail_when_unknown_project_dispatcher_on_private_project() { | |||
void fail_when_unknown_project_dispatcher_on_private_project() { | |||
ProjectData project = db.components().insertPrivateProject(); | |||
userSession.addProjectPermission(USER, project.getProjectDto()); | |||
when(dispatchers.getGlobalDispatchers()).thenReturn(asList(NOTIF_MY_NEW_ISSUES, NOTIF_NEW_ISSUES)); | |||
@@ -276,7 +276,7 @@ public class AddActionIT { | |||
} | |||
@Test | |||
public void fail_when_unknown_project_dispatcher_on_public_project() { | |||
void fail_when_unknown_project_dispatcher_on_public_project() { | |||
UserDto user = db.users().insertUser(); | |||
userSession.logIn(user); | |||
ComponentDto project = db.components().insertPublicProject().getMainBranchComponent(); | |||
@@ -290,14 +290,14 @@ public class AddActionIT { | |||
} | |||
@Test | |||
public void fail_when_no_dispatcher() { | |||
void fail_when_no_dispatcher() { | |||
TestRequest request = ws.newRequest(); | |||
assertThatThrownBy(request::execute) | |||
.isInstanceOf(IllegalArgumentException.class); | |||
} | |||
@Test | |||
public void fail_when_project_is_unknown() { | |||
void fail_when_project_is_unknown() { | |||
UserDto user = db.users().insertUser(); | |||
userSession.logIn(user); | |||
when(dispatchers.getGlobalDispatchers()).thenReturn(singletonList(NOTIF_MY_NEW_ISSUES)); | |||
@@ -308,7 +308,7 @@ public class AddActionIT { | |||
} | |||
@Test | |||
public void fail_when_component_is_not_a_project() { | |||
void fail_when_component_is_not_a_project() { | |||
UserDto user = db.users().insertUser(); | |||
userSession.logIn(user); | |||
db.components().insertPortfolioAndSnapshot(newPortfolio().setKey("VIEW_1")); | |||
@@ -321,7 +321,7 @@ public class AddActionIT { | |||
} | |||
@Test | |||
public void fail_when_not_authenticated() { | |||
void fail_when_not_authenticated() { | |||
userSession.anonymous(); | |||
when(dispatchers.getGlobalDispatchers()).thenReturn(singletonList(NOTIF_MY_NEW_ISSUES)); | |||
@@ -330,7 +330,7 @@ public class AddActionIT { | |||
} | |||
@Test | |||
public void fail_when_user_does_not_have_USER_permission_on_private_project() { | |||
void fail_when_user_does_not_have_USER_permission_on_private_project() { | |||
ComponentDto project = db.components().insertPrivateProject().getMainBranchComponent(); | |||
userSession.logIn().setNonSystemAdministrator(); | |||
when(dispatchers.getGlobalDispatchers()).thenReturn(singletonList(NOTIF_MY_NEW_ISSUES)); |
@@ -31,6 +31,7 @@ dependencies { | |||
testImplementation 'org.apache.logging.log4j:log4j-core' | |||
testImplementation 'com.google.code.findbugs:jsr305' | |||
testImplementation 'com.tngtech.java:junit-dataprovider' | |||
testImplementation 'org.junit.jupiter:junit-jupiter-api' | |||
testImplementation 'org.mockito:mockito-core' | |||
testImplementation 'org.eclipse.jetty:jetty-server' | |||
testImplementation 'org.eclipse.jetty:jetty-servlet' | |||
@@ -39,4 +40,12 @@ dependencies { | |||
testImplementation testFixtures(project(':server:sonar-webserver-auth')) | |||
testImplementation testFixtures(project(':server:sonar-webserver-es')) | |||
testImplementation project(':sonar-testing-harness') | |||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' | |||
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine' | |||
} | |||
test { | |||
// Enabling the JUnit Platform (see https://github.com/junit-team/junit5-samples/tree/master/junit5-migration-gradle) | |||
useJUnitPlatform() | |||
} |
@@ -33,14 +33,11 @@ import java.util.Properties; | |||
import java.util.zip.GZIPOutputStream; | |||
import org.hamcrest.BaseMatcher; | |||
import org.hamcrest.Description; | |||
import org.junit.AfterClass; | |||
import org.junit.BeforeClass; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.junit.rules.DisableOnDebug; | |||
import org.junit.rules.TemporaryFolder; | |||
import org.junit.rules.TestRule; | |||
import org.junit.rules.Timeout; | |||
import org.junit.jupiter.api.AfterAll; | |||
import org.junit.jupiter.api.BeforeAll; | |||
import org.junit.jupiter.api.Test; | |||
import org.junit.jupiter.api.Timeout; | |||
import org.junit.jupiter.api.io.TempDir; | |||
import org.simpleframework.http.Request; | |||
import org.simpleframework.http.Response; | |||
import org.simpleframework.http.core.Container; | |||
@@ -57,19 +54,16 @@ import static org.mockito.Mockito.mock; | |||
import static org.mockito.Mockito.when; | |||
import static org.sonar.api.utils.HttpDownloader.HttpException; | |||
public class DefaultHttpDownloaderIT { | |||
class DefaultHttpDownloaderIT { | |||
@Rule | |||
public TemporaryFolder temporaryFolder = new TemporaryFolder(); | |||
@Rule | |||
public TestRule safeguardTimeout = new DisableOnDebug(Timeout.seconds(60)); | |||
@TempDir | |||
private File temporaryFolder; | |||
private static SocketConnection socketConnection; | |||
private static String baseUrl; | |||
@BeforeClass | |||
public static void startServer() throws IOException { | |||
@BeforeAll | |||
static void startServer() throws IOException { | |||
socketConnection = new SocketConnection(new ContainerServer(new Container() { | |||
public void handle(Request req, Response resp) { | |||
try { | |||
@@ -116,15 +110,17 @@ public class DefaultHttpDownloaderIT { | |||
resp.getPrintStream().append("agent=" + req.getValues("User-Agent").get(0)); | |||
} | |||
@AfterClass | |||
public static void stopServer() throws IOException { | |||
@AfterAll | |||
static void stopServer() throws IOException { | |||
if (null != socketConnection) { | |||
socketConnection.close(); | |||
} | |||
} | |||
@Test(timeout = 10000) | |||
public void openStream_network_errors() throws IOException, URISyntaxException { | |||
@Test | |||
// To disable the timeout in debug mode, run the test with -Djunit.jupiter.execution.timeout.mode=disabled_on_debug | |||
@Timeout(10) | |||
void openStream_network_errors() throws IOException, URISyntaxException { | |||
// host not accepting connections | |||
String url = "http://127.0.0.1:1"; | |||
@@ -146,33 +142,32 @@ public class DefaultHttpDownloaderIT { | |||
} | |||
@Test | |||
public void downloadBytes() throws URISyntaxException { | |||
void downloadBytes() throws URISyntaxException { | |||
byte[] bytes = new DefaultHttpDownloader(mock(Server.class), new MapSettings().asConfig()).readBytes(new URI(baseUrl)); | |||
assertThat(bytes).hasSizeGreaterThan(10); | |||
} | |||
@Test | |||
public void readString() throws URISyntaxException { | |||
void readString() throws URISyntaxException { | |||
String text = new DefaultHttpDownloader(mock(Server.class), new MapSettings().asConfig()).readString(new URI(baseUrl), StandardCharsets.UTF_8); | |||
assertThat(text.length()).isGreaterThan(10); | |||
} | |||
@Test | |||
public void readGzipString() throws URISyntaxException { | |||
void readGzipString() throws URISyntaxException { | |||
String text = new DefaultHttpDownloader(mock(Server.class), new MapSettings().asConfig()).readString(new URI(baseUrl + "/gzip/"), StandardCharsets.UTF_8); | |||
assertThat(text).isEqualTo("GZIP response"); | |||
} | |||
@Test | |||
public void readStringWithDefaultTimeout() throws URISyntaxException { | |||
void readStringWithDefaultTimeout() throws URISyntaxException { | |||
String text = new DefaultHttpDownloader(mock(Server.class), new MapSettings().asConfig()).readString(new URI(baseUrl + "/timeout/"), StandardCharsets.UTF_8); | |||
assertThat(text.length()).isGreaterThan(10); | |||
} | |||
@Test | |||
public void downloadToFile() throws URISyntaxException, IOException { | |||
File toDir = temporaryFolder.newFolder(); | |||
File toFile = new File(toDir, "downloadToFile.txt"); | |||
void downloadToFile() throws URISyntaxException, IOException { | |||
File toFile = new File(temporaryFolder, "downloadToFile.txt"); | |||
new DefaultHttpDownloader(mock(Server.class), new MapSettings().asConfig()).download(new URI(baseUrl), toFile); | |||
assertThat(toFile).exists(); | |||
@@ -180,9 +175,8 @@ public class DefaultHttpDownloaderIT { | |||
} | |||
@Test | |||
public void shouldNotCreateFileIfFailToDownload() throws Exception { | |||
File toDir = temporaryFolder.newFolder(); | |||
File toFile = new File(toDir, "downloadToFile.txt"); | |||
void shouldNotCreateFileIfFailToDownload() throws Exception { | |||
File toFile = new File(temporaryFolder, "downloadToFile.txt"); | |||
try { | |||
new DefaultHttpDownloader(mock(Server.class), new MapSettings().asConfig()).download(new URI("http://localhost:1"), toFile); | |||
@@ -192,7 +186,7 @@ public class DefaultHttpDownloaderIT { | |||
} | |||
@Test | |||
public void userAgent_includes_version_and_SERVER_ID_when_server_is_provided() throws URISyntaxException, IOException { | |||
void userAgent_includes_version_and_SERVER_ID_when_server_is_provided() throws URISyntaxException, IOException { | |||
Server server = mock(Server.class); | |||
when(server.getVersion()).thenReturn("2.2"); | |||
MapSettings settings = new MapSettings(); | |||
@@ -207,7 +201,7 @@ public class DefaultHttpDownloaderIT { | |||
} | |||
@Test | |||
public void userAgent_includes_only_version_when_there_is_no_SERVER_ID_and_server_is_provided() throws URISyntaxException, IOException { | |||
void userAgent_includes_only_version_when_there_is_no_SERVER_ID_and_server_is_provided() throws URISyntaxException, IOException { | |||
Server server = mock(Server.class); | |||
when(server.getVersion()).thenReturn("2.2"); | |||
@@ -220,24 +214,24 @@ public class DefaultHttpDownloaderIT { | |||
} | |||
@Test | |||
public void followRedirect() throws URISyntaxException { | |||
void followRedirect() throws URISyntaxException { | |||
String content = new DefaultHttpDownloader(mock(Server.class), new MapSettings().asConfig()).readString(new URI(baseUrl + "/redirect/"), StandardCharsets.UTF_8); | |||
assertThat(content).isEqualTo("redirected"); | |||
} | |||
@Test | |||
public void supported_schemes() { | |||
void supported_schemes() { | |||
assertThat(new DefaultHttpDownloader(mock(Server.class), new MapSettings().asConfig()).getSupportedSchemes()).contains("http"); | |||
} | |||
@Test | |||
public void uri_description() throws URISyntaxException { | |||
void uri_description() throws URISyntaxException { | |||
String description = new DefaultHttpDownloader(mock(Server.class), new MapSettings().asConfig()).description(new URI("http://sonarsource.org")); | |||
assertThat(description).isEqualTo("http://sonarsource.org"); | |||
} | |||
@Test | |||
public void readBytes_whenServerReturnsError_shouldThrow() throws URISyntaxException { | |||
void readBytes_whenServerReturnsError_shouldThrow() throws URISyntaxException { | |||
DefaultHttpDownloader downloader = new DefaultHttpDownloader(mock(Server.class), new MapSettings().asConfig()); | |||
URI errorUri = new URI(baseUrl + "/error"); | |||
assertThatThrownBy(() -> downloader.readBytes(errorUri)).isInstanceOf(HttpException.class).hasMessage("Fail to download [" + errorUri + "]. Response code: 500"); |
@@ -40,6 +40,9 @@ import javax.annotation.CheckForNull; | |||
import javax.annotation.Nullable; | |||
import javax.annotation.Priority; | |||
import org.apache.commons.io.FileUtils; | |||
import org.junit.jupiter.api.extension.AfterTestExecutionCallback; | |||
import org.junit.jupiter.api.extension.BeforeTestExecutionCallback; | |||
import org.junit.jupiter.api.extension.ExtensionContext; | |||
import org.junit.rules.ExternalResource; | |||
import org.sonar.api.Plugin; | |||
import org.sonar.api.SonarEdition; | |||
@@ -88,7 +91,7 @@ import static java.util.Collections.emptySet; | |||
/** | |||
* Main utility class for writing scanner medium tests. | |||
*/ | |||
public class ScannerMediumTester extends ExternalResource { | |||
public class ScannerMediumTester extends ExternalResource implements BeforeTestExecutionCallback, AfterTestExecutionCallback { | |||
private static Path userHome = null; | |||
private final Map<String, String> globalProperties = new HashMap<>(); | |||
@@ -245,6 +248,16 @@ public class ScannerMediumTester extends ExternalResource { | |||
return this; | |||
} | |||
@Override | |||
public void afterTestExecution(ExtensionContext extensionContext) { | |||
after(); | |||
} | |||
@Override | |||
public void beforeTestExecution(ExtensionContext extensionContext) { | |||
before(); | |||
} | |||
@Override | |||
protected void before() { | |||
try { | |||
@@ -267,6 +280,7 @@ public class ScannerMediumTester extends ExternalResource { | |||
} | |||
} | |||
public AnalysisBuilder newAnalysis() { | |||
return new AnalysisBuilder(this); | |||
} |
@@ -27,15 +27,15 @@ import java.nio.file.Files; | |||
import java.nio.file.Path; | |||
import java.util.List; | |||
import org.apache.commons.io.FileUtils; | |||
import org.junit.Before; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.junit.rules.TemporaryFolder; | |||
import org.junit.jupiter.api.BeforeEach; | |||
import org.junit.jupiter.api.Test; | |||
import org.junit.jupiter.api.extension.RegisterExtension; | |||
import org.junit.jupiter.api.io.TempDir; | |||
import org.slf4j.event.Level; | |||
import org.sonar.api.batch.fs.internal.DefaultInputFile; | |||
import org.sonar.api.batch.fs.internal.FileMetadata; | |||
import org.sonar.api.notifications.AnalysisWarnings; | |||
import org.sonar.api.testfixtures.log.LogTester; | |||
import org.sonar.api.testfixtures.log.LogTesterJUnit5; | |||
import org.sonar.scanner.mediumtest.AnalysisResult; | |||
import org.sonar.scanner.mediumtest.ScannerMediumTester; | |||
import org.sonar.scanner.protocol.output.ScannerReport; | |||
@@ -48,31 +48,31 @@ import org.sonarqube.ws.NewCodePeriods; | |||
import static org.assertj.core.api.Assertions.assertThat; | |||
import static org.mockito.Mockito.mock; | |||
public class BranchMediumIT { | |||
class BranchMediumIT { | |||
private static final String PROJECT_KEY = "sample"; | |||
private static final String FILE_PATH = "HelloJava.xoo"; | |||
private static final String FILE_CONTENT = "xoooo"; | |||
public static final String ONE_ISSUE_PER_LINE_IS_RESTRICTED_TO_CHANGED_FILES_ONLY = "Sensor One Issue Per Line is restricted to changed files only"; | |||
private static final String ONE_ISSUE_PER_LINE_IS_RESTRICTED_TO_CHANGED_FILES_ONLY = "Sensor One Issue Per Line is restricted to changed files only"; | |||
private File baseDir; | |||
@Rule | |||
public TemporaryFolder temp = new TemporaryFolder(); | |||
@TempDir | |||
public File temp; | |||
@Rule | |||
public LogTester logTester = new LogTester(); | |||
@RegisterExtension | |||
public LogTesterJUnit5 logTester = new LogTesterJUnit5(); | |||
@Rule | |||
@RegisterExtension | |||
public ScannerMediumTester tester = new ScannerMediumTester() | |||
.registerPlugin("xoo", new XooPlugin()) | |||
.addDefaultQProfile("xoo", "Sonar Way") | |||
.addRules(new XooRulesDefinition()) | |||
.addActiveRule("xoo", "OneIssuePerLine", null, "One issue per line", "MAJOR", "OneIssuePerLine.internal", "xoo"); | |||
@Before | |||
public void prepare() throws IOException { | |||
@BeforeEach | |||
void prepare() throws IOException { | |||
logTester.setLevel(Level.DEBUG); | |||
baseDir = temp.newFolder(); | |||
baseDir = temp; | |||
Path filepath = baseDir.toPath().resolve(FILE_PATH); | |||
Files.write(filepath, FILE_CONTENT.getBytes()); | |||
@@ -87,7 +87,7 @@ public class BranchMediumIT { | |||
} | |||
@Test | |||
public void should_not_skip_report_for_unchanged_files_in_pr() { | |||
void should_not_skip_report_for_unchanged_files_in_pr() { | |||
// sanity check, normally report gets generated | |||
AnalysisResult result = getResult(tester); | |||
final DefaultInputFile file = (DefaultInputFile) result.inputFile(FILE_PATH); | |||
@@ -108,7 +108,7 @@ public class BranchMediumIT { | |||
} | |||
@Test | |||
public void shouldSkipSensorForUnchangedFilesOnPr() { | |||
void shouldSkipSensorForUnchangedFilesOnPr() { | |||
AnalysisResult result = getResult(tester | |||
.setBranchName("myBranch") | |||
.setBranchTarget("main") | |||
@@ -122,7 +122,7 @@ public class BranchMediumIT { | |||
} | |||
@Test | |||
public void shouldNotSkipSensorForUnchangedFilesOnBranch() throws Exception { | |||
void shouldNotSkipSensorForUnchangedFilesOnBranch() throws Exception { | |||
AnalysisResult result = getResult(tester | |||
.setBranchName("myBranch") | |||
.setBranchTarget("main") | |||
@@ -136,7 +136,7 @@ public class BranchMediumIT { | |||
} | |||
@Test | |||
public void verify_metadata() { | |||
void verify_metadata() { | |||
String branchName = "feature"; | |||
String branchTarget = "branch-1.x"; | |||
@@ -24,10 +24,10 @@ import java.io.File; | |||
import java.io.IOException; | |||
import java.util.Map; | |||
import org.apache.commons.io.FileUtils; | |||
import org.junit.Before; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.junit.rules.TemporaryFolder; | |||
import org.junit.jupiter.api.BeforeEach; | |||
import org.junit.jupiter.api.Test; | |||
import org.junit.jupiter.api.extension.RegisterExtension; | |||
import org.junit.jupiter.api.io.TempDir; | |||
import org.sonar.api.utils.MessageException; | |||
import org.sonar.scanner.mediumtest.ScannerMediumTester; | |||
import org.sonar.xoo.XooPlugin; | |||
@@ -35,13 +35,13 @@ import org.sonar.xoo.rule.XooRulesDefinition; | |||
import static org.assertj.core.api.Assertions.assertThatThrownBy; | |||
public class DeprecatedBranchMediumIT { | |||
class DeprecatedBranchMediumIT { | |||
@Rule | |||
public TemporaryFolder temp = new TemporaryFolder(); | |||
@TempDir | |||
private File temp; | |||
@Rule | |||
public ScannerMediumTester tester = new ScannerMediumTester() | |||
@RegisterExtension | |||
private final ScannerMediumTester tester = new ScannerMediumTester() | |||
.registerPlugin("xoo", new XooPlugin()) | |||
.addRules(new XooRulesDefinition()) | |||
// active a rule just to be sure that xoo files are published | |||
@@ -52,9 +52,9 @@ public class DeprecatedBranchMediumIT { | |||
private Map<String, String> commonProps; | |||
@Before | |||
public void prepare() { | |||
baseDir = temp.getRoot(); | |||
@BeforeEach | |||
void prepare() { | |||
baseDir = temp; | |||
commonProps = ImmutableMap.<String, String>builder() | |||
.put("sonar.task", "scan") | |||
@@ -68,7 +68,7 @@ public class DeprecatedBranchMediumIT { | |||
} | |||
@Test | |||
public void scanProjectWithBranch() throws IOException { | |||
void scanProjectWithBranch() throws IOException { | |||
File srcDir = new File(baseDir, "src"); | |||
srcDir.mkdir(); | |||
@@ -24,13 +24,13 @@ import java.io.File; | |||
import java.io.IOException; | |||
import java.nio.charset.StandardCharsets; | |||
import org.apache.commons.io.FileUtils; | |||
import org.junit.Before; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.junit.rules.TemporaryFolder; | |||
import org.junit.jupiter.api.BeforeEach; | |||
import org.junit.jupiter.api.Test; | |||
import org.junit.jupiter.api.extension.RegisterExtension; | |||
import org.junit.jupiter.api.io.TempDir; | |||
import org.slf4j.event.Level; | |||
import org.sonar.api.batch.fs.InputFile; | |||
import org.sonar.api.testfixtures.log.LogTester; | |||
import org.sonar.api.testfixtures.log.LogTesterJUnit5; | |||
import org.sonar.scanner.mediumtest.AnalysisResult; | |||
import org.sonar.scanner.mediumtest.ScannerMediumTester; | |||
import org.sonar.scanner.protocol.output.ScannerReport; | |||
@@ -39,28 +39,28 @@ import org.sonar.xoo.XooPlugin; | |||
import static org.assertj.core.api.Assertions.assertThat; | |||
import static org.assertj.core.api.AssertionsForClassTypes.tuple; | |||
public class CoverageMediumIT { | |||
class CoverageMediumIT { | |||
@Rule | |||
public LogTester logTester = new LogTester(); | |||
@RegisterExtension | |||
private final LogTesterJUnit5 logTester = new LogTesterJUnit5(); | |||
@Rule | |||
public TemporaryFolder temp = new TemporaryFolder(); | |||
@TempDir | |||
private File temp; | |||
@Rule | |||
public ScannerMediumTester tester = new ScannerMediumTester() | |||
@RegisterExtension | |||
private final ScannerMediumTester tester = new ScannerMediumTester() | |||
.registerPlugin("xoo", new XooPlugin()) | |||
.addDefaultQProfile("xoo", "Sonar Way"); | |||
@Before | |||
public void prepare() throws IOException { | |||
@BeforeEach | |||
void prepare() throws IOException { | |||
logTester.setLevel(Level.DEBUG); | |||
} | |||
@Test | |||
public void singleReport() throws IOException { | |||
void singleReport() throws IOException { | |||
File baseDir = temp.getRoot(); | |||
File baseDir = temp; | |||
File srcDir = new File(baseDir, "src"); | |||
srcDir.mkdir(); | |||
@@ -84,9 +84,9 @@ public class CoverageMediumIT { | |||
} | |||
@Test | |||
public void twoReports() throws IOException { | |||
void twoReports() throws IOException { | |||
File baseDir = temp.getRoot(); | |||
File baseDir = temp; | |||
File srcDir = new File(baseDir, "src"); | |||
srcDir.mkdir(); | |||
@@ -113,9 +113,9 @@ public class CoverageMediumIT { | |||
} | |||
@Test | |||
public void exclusionsForSimpleProject() throws IOException { | |||
void exclusionsForSimpleProject() throws IOException { | |||
File baseDir = temp.getRoot(); | |||
File baseDir = temp; | |||
File srcDir = new File(baseDir, "src"); | |||
srcDir.mkdir(); | |||
@@ -138,9 +138,9 @@ public class CoverageMediumIT { | |||
} | |||
@Test | |||
public void warn_user_for_outdated_inherited_scanner_side_exclusions_for_multi_module_project() throws IOException { | |||
void warn_user_for_outdated_inherited_scanner_side_exclusions_for_multi_module_project() throws IOException { | |||
File baseDir = temp.getRoot(); | |||
File baseDir = temp; | |||
File baseDirModuleA = new File(baseDir, "moduleA"); | |||
File baseDirModuleB = new File(baseDir, "moduleB"); | |||
File srcDirA = new File(baseDirModuleA, "src"); | |||
@@ -179,9 +179,9 @@ public class CoverageMediumIT { | |||
} | |||
@Test | |||
public void module_level_exclusions_override_parent_for_multi_module_project() throws IOException { | |||
void module_level_exclusions_override_parent_for_multi_module_project() throws IOException { | |||
File baseDir = temp.getRoot(); | |||
File baseDir = temp; | |||
File baseDirModuleA = new File(baseDir, "moduleA"); | |||
File baseDirModuleB = new File(baseDir, "moduleB"); | |||
File srcDirA = new File(baseDirModuleA, "src"); | |||
@@ -218,9 +218,9 @@ public class CoverageMediumIT { | |||
} | |||
@Test | |||
public void warn_user_for_outdated_server_side_exclusions_for_multi_module_project() throws IOException { | |||
void warn_user_for_outdated_server_side_exclusions_for_multi_module_project() throws IOException { | |||
File baseDir = temp.getRoot(); | |||
File baseDir = temp; | |||
File baseDirModuleA = new File(baseDir, "moduleA"); | |||
File baseDirModuleB = new File(baseDir, "moduleB"); | |||
File srcDirA = new File(baseDirModuleA, "src"); | |||
@@ -260,9 +260,9 @@ public class CoverageMediumIT { | |||
} | |||
@Test | |||
public void fallbackOnExecutableLines() throws IOException { | |||
void fallbackOnExecutableLines() throws IOException { | |||
File baseDir = temp.getRoot(); | |||
File baseDir = temp; | |||
File srcDir = new File(baseDir, "src"); | |||
srcDir.mkdir(); | |||
@@ -296,9 +296,9 @@ public class CoverageMediumIT { | |||
// SONAR-11641 | |||
@Test | |||
public void dontFallbackOnExecutableLinesIfNoCoverageSaved() throws IOException { | |||
void dontFallbackOnExecutableLinesIfNoCoverageSaved() throws IOException { | |||
File baseDir = temp.getRoot(); | |||
File baseDir = temp; | |||
File srcDir = new File(baseDir, "src"); | |||
srcDir.mkdir(); | |||
@@ -327,9 +327,9 @@ public class CoverageMediumIT { | |||
// SONAR-9557 | |||
@Test | |||
public void exclusionsAndForceToZeroOnModules() throws IOException { | |||
void exclusionsAndForceToZeroOnModules() throws IOException { | |||
File baseDir = temp.getRoot(); | |||
File baseDir = temp; | |||
File srcDir = new File(baseDir, "module1/src"); | |||
srcDir.mkdir(); | |||