aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch/src/test/java/org/sonar
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2013-02-03 21:50:16 +0100
committerSimon Brandhof <simon.brandhof@gmail.com>2013-02-03 21:57:31 +0100
commitbb0bcf4dfb1eef2ff42655d5e00b5d62c7bc4a6e (patch)
tree169215a45203a91ac63222278c3064d1307cfd75 /sonar-batch/src/test/java/org/sonar
parentee051c0da6dbc967b50eee86bd906f372ad4e8bf (diff)
downloadsonarqube-bb0bcf4dfb1eef2ff42655d5e00b5d62c7bc4a6e.tar.gz
sonarqube-bb0bcf4dfb1eef2ff42655d5e00b5d62c7bc4a6e.zip
Remove some calls to commons-collections
Diffstat (limited to 'sonar-batch/src/test/java/org/sonar')
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/DecoratorsSelectorTest.java24
1 files changed, 11 insertions, 13 deletions
diff --git a/sonar-batch/src/test/java/org/sonar/batch/DecoratorsSelectorTest.java b/sonar-batch/src/test/java/org/sonar/batch/DecoratorsSelectorTest.java
index 4cbb299f9c9..153d63b0908 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/DecoratorsSelectorTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/DecoratorsSelectorTest.java
@@ -19,7 +19,7 @@
*/
package org.sonar.batch;
-import org.apache.commons.collections.CollectionUtils;
+import com.google.common.collect.Iterables;
import org.junit.Test;
import org.sonar.api.batch.BatchExtensionDictionnary;
import org.sonar.api.batch.Decorator;
@@ -38,9 +38,7 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.List;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-import static org.junit.internal.matchers.IsCollectionContaining.hasItem;
+import static org.fest.assertions.Assertions.assertThat;
public class DecoratorsSelectorTest {
@@ -54,9 +52,9 @@ public class DecoratorsSelectorTest {
BatchExtensionDictionnary batchExtDictionnary = newBatchDictionnary(withFormula1, withoutFormula3, withFormula2);
Collection<Decorator> decorators = new DecoratorsSelector(batchExtDictionnary).select(project);
- assertThat(decorators.size(), is(2));
- assertThat(decorators, hasItem((Decorator) new FormulaDecorator(withFormula1)));
- assertThat(decorators, hasItem((Decorator) new FormulaDecorator(withFormula2)));
+ assertThat(decorators).hasSize(2);
+ assertThat(decorators).contains(new FormulaDecorator(withFormula1));
+ assertThat(decorators).contains(new FormulaDecorator(withFormula2));
}
@Test
@@ -67,15 +65,15 @@ public class DecoratorsSelectorTest {
Collection<Decorator> decorators = new DecoratorsSelector(batchExtDictionnary).select(project);
- Decorator firstDecorator = (Decorator) CollectionUtils.get(decorators, 0);
- Decorator secondDecorator = (Decorator) CollectionUtils.get(decorators, 1);
+ Decorator firstDecorator = Iterables.get(decorators, 0);
+ Decorator secondDecorator = Iterables.get(decorators, 1);
- assertThat(firstDecorator, is(Metric1Decorator.class));
- assertThat(secondDecorator, is(FormulaDecorator.class));
+ assertThat(firstDecorator).isInstanceOf(Metric1Decorator.class);
+ assertThat(secondDecorator).isInstanceOf(FormulaDecorator.class);
FormulaDecorator formulaDecorator = (FormulaDecorator) secondDecorator;
- assertThat(formulaDecorator.dependsUponDecorators().size(), is(1));
- assertThat(CollectionUtils.get(formulaDecorator.dependsUponDecorators(), 0), is((Object) firstDecorator));
+ assertThat(formulaDecorator.dependsUponDecorators()).hasSize(1);
+ assertThat(Iterables.get(formulaDecorator.dependsUponDecorators(), 0)).isEqualTo(firstDecorator);
}
private BatchExtensionDictionnary newBatchDictionnary(Object... extensions) {