aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-db
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2016-05-04 17:37:53 +0200
committerJulien Lancelot <julien.lancelot@sonarsource.com>2016-05-04 17:37:53 +0200
commitb658f0cefa459ef82072c080f0acf92b438fca8e (patch)
tree3c0c9272d6c78c4ad3374e04c392d5c97a13adb3 /sonar-db
parent7de0b077cfac6c5555129e6d81e733d2cae3efd8 (diff)
downloadsonarqube-b658f0cefa459ef82072c080f0acf92b438fca8e.tar.gz
sonarqube-b658f0cefa459ef82072c080f0acf92b438fca8e.zip
SONAR-7108 Fix unpredictable behavior of UT
Diffstat (limited to 'sonar-db')
-rw-r--r--sonar-db/src/test/java/org/sonar/db/purge/PurgeDaoTest.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/sonar-db/src/test/java/org/sonar/db/purge/PurgeDaoTest.java b/sonar-db/src/test/java/org/sonar/db/purge/PurgeDaoTest.java
index 92dd370ae72..637a8f3e103 100644
--- a/sonar-db/src/test/java/org/sonar/db/purge/PurgeDaoTest.java
+++ b/sonar-db/src/test/java/org/sonar/db/purge/PurgeDaoTest.java
@@ -19,9 +19,11 @@
*/
package org.sonar.db.purge;
+import java.util.ArrayList;
import java.util.List;
import org.junit.Rule;
import org.junit.Test;
+import org.mockito.ArgumentCaptor;
import org.sonar.api.resources.Scopes;
import org.sonar.api.utils.System2;
import org.sonar.core.util.Uuids;
@@ -33,7 +35,6 @@ import org.sonar.db.ce.CeQueueDto;
import org.sonar.db.component.ComponentDto;
import org.sonar.db.component.ComponentTesting;
-import static java.util.Arrays.asList;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
@@ -179,7 +180,12 @@ public class PurgeDaoTest {
underTest.purge(newConfigurationWith30Days(), purgeListener, new PurgeProfiler());
dbTester.assertDbUnit(getClass(), "should_delete_old_closed_issues-result.xml", "issues", "issue_changes");
- verify(purgeListener).onIssuesRemoval(asList("ISSUE-1", "ISSUE-2"));
+
+ Class<ArrayList<String>> listClass = (Class<ArrayList<String>>)(Class)ArrayList.class;
+ ArgumentCaptor<ArrayList<String>> argument = ArgumentCaptor.forClass(listClass);
+
+ verify(purgeListener).onIssuesRemoval(argument.capture());
+ assertThat(argument.getValue()).containsOnly("ISSUE-1", "ISSUE-2");
}
@Test