diff options
Diffstat (limited to 'server/sonar-webserver-api/src/test')
2 files changed, 12 insertions, 14 deletions
diff --git a/server/sonar-webserver-api/src/test/java/org/sonar/server/project/ProjectLifeCycleListenersImplTest.java b/server/sonar-webserver-api/src/test/java/org/sonar/server/project/ProjectLifeCycleListenersImplTest.java index 823804ff893..a84ee7fd7f4 100644 --- a/server/sonar-webserver-api/src/test/java/org/sonar/server/project/ProjectLifeCycleListenersImplTest.java +++ b/server/sonar-webserver-api/src/test/java/org/sonar/server/project/ProjectLifeCycleListenersImplTest.java @@ -39,20 +39,19 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.same; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.sonar.db.component.ComponentTesting.newPrivateProjectDto; -import static org.sonar.db.organization.OrganizationTesting.newOrganizationDto; @RunWith(DataProviderRunner.class) public class ProjectLifeCycleListenersImplTest { @Rule public ExpectedException expectedException = ExpectedException.none(); - private ProjectLifeCycleListener listener1 = mock(ProjectLifeCycleListener.class); - private ProjectLifeCycleListener listener2 = mock(ProjectLifeCycleListener.class); - private ProjectLifeCycleListener listener3 = mock(ProjectLifeCycleListener.class); - private ProjectLifeCycleListenersImpl underTestNoListeners = new ProjectLifeCycleListenersImpl(); - private ProjectLifeCycleListenersImpl underTestWithListeners = new ProjectLifeCycleListenersImpl( + private final ProjectLifeCycleListener listener1 = mock(ProjectLifeCycleListener.class); + private final ProjectLifeCycleListener listener2 = mock(ProjectLifeCycleListener.class); + private final ProjectLifeCycleListener listener3 = mock(ProjectLifeCycleListener.class); + private final ProjectLifeCycleListenersImpl underTestNoListeners = new ProjectLifeCycleListenersImpl(); + private final ProjectLifeCycleListenersImpl underTestWithListeners = new ProjectLifeCycleListenersImpl( new ProjectLifeCycleListener[] {listener1, listener2, listener3}); @Test @@ -76,7 +75,7 @@ public class ProjectLifeCycleListenersImplTest { underTestNoListeners.onProjectsDeleted(Collections.emptySet()); underTestWithListeners.onProjectsDeleted(Collections.emptySet()); - verifyZeroInteractions(listener1, listener2, listener3); + verifyNoInteractions(listener1, listener2, listener3); } @Test @@ -151,7 +150,7 @@ public class ProjectLifeCycleListenersImplTest { underTestNoListeners.onProjectBranchesDeleted(Collections.emptySet()); underTestWithListeners.onProjectBranchesDeleted(Collections.emptySet()); - verifyZeroInteractions(listener1, listener2, listener3); + verifyNoInteractions(listener1, listener2, listener3); } @Test @@ -235,7 +234,7 @@ public class ProjectLifeCycleListenersImplTest { underTestNoListeners.onProjectsRekeyed(Collections.emptySet()); underTestWithListeners.onProjectsRekeyed(Collections.emptySet()); - verifyZeroInteractions(listener1, listener2, listener3); + verifyNoInteractions(listener1, listener2, listener3); } @Test @@ -298,14 +297,14 @@ public class ProjectLifeCycleListenersImplTest { } private static Project newUniqueProject() { - return Project.from(newPrivateProjectDto(newOrganizationDto())); + return Project.from(newPrivateProjectDto()); } private static int counter = 3_989; private static RekeyedProject newUniqueRekeyedProject() { int base = counter++; - Project project = Project.from(newPrivateProjectDto(newOrganizationDto())); + Project project = Project.from(newPrivateProjectDto()); return new RekeyedProject(project, base + "_old_key"); } } diff --git a/server/sonar-webserver-api/src/test/java/org/sonar/server/project/RekeyedProjectTest.java b/server/sonar-webserver-api/src/test/java/org/sonar/server/project/RekeyedProjectTest.java index e37d1bafdd5..285d724d654 100644 --- a/server/sonar-webserver-api/src/test/java/org/sonar/server/project/RekeyedProjectTest.java +++ b/server/sonar-webserver-api/src/test/java/org/sonar/server/project/RekeyedProjectTest.java @@ -27,7 +27,6 @@ import static java.util.Collections.emptyList; import static org.apache.commons.lang.RandomStringUtils.randomAlphanumeric; import static org.assertj.core.api.Assertions.assertThat; import static org.sonar.db.component.ComponentTesting.newPrivateProjectDto; -import static org.sonar.db.organization.OrganizationTesting.newOrganizationDto; public class RekeyedProjectTest { @Rule @@ -97,6 +96,6 @@ public class RekeyedProjectTest { } private static Project newRandomProject() { - return Project.from(newPrivateProjectDto(newOrganizationDto())); + return Project.from(newPrivateProjectDto()); } } |