@@ -19,17 +19,18 @@ | |||
*/ | |||
package org.sonar.duplications.detector; | |||
import org.hamcrest.CoreMatchers; | |||
import org.hamcrest.Description; | |||
import org.hamcrest.Matcher; | |||
import org.hamcrest.TypeSafeMatcher; | |||
import org.sonar.duplications.index.CloneGroup; | |||
import org.sonar.duplications.index.ClonePart; | |||
import static org.hamcrest.Matchers.hasItem; | |||
public class CloneGroupMatcher extends TypeSafeMatcher<CloneGroup> { | |||
public static Matcher<Iterable<? super CloneGroup>> hasCloneGroup(int expectedLen, ClonePart... expectedParts) { | |||
return CoreMatchers.hasItem(new CloneGroupMatcher(expectedLen, expectedParts)); | |||
return hasItem(new CloneGroupMatcher(expectedLen, expectedParts)); | |||
} | |||
private final int expectedLen; |
@@ -27,7 +27,6 @@ import java.io.File; | |||
import java.util.List; | |||
import java.util.Properties; | |||
import org.hamcrest.CoreMatchers; | |||
import org.junit.Test; | |||
import org.sonar.api.CoreProperties; | |||
@@ -137,8 +136,8 @@ public class ProjectDefinitionTest { | |||
def.addBinaryDir(new File("target/classes")); | |||
assertThat(def.getSourceDirs().size(), is(2)); | |||
assertThat(def.getTestDirs().size(), CoreMatchers.is(2)); | |||
assertThat(def.getBinaries().size(), CoreMatchers.is(1)); | |||
assertThat(def.getTestDirs().size(), is(2)); | |||
assertThat(def.getBinaries().size(), is(1)); | |||
} | |||
@Test |
@@ -26,8 +26,8 @@ import org.junit.Test; | |||
import java.lang.reflect.Field; | |||
import java.util.List; | |||
import static org.hamcrest.Matchers.hasItem; | |||
import static org.junit.Assert.assertThat; | |||
import static org.junit.matchers.JUnitMatchers.hasItem; | |||
public class FieldUtils2Test { | |||
@@ -19,7 +19,6 @@ | |||
*/ | |||
package org.sonar.wsclient.unmarshallers; | |||
import org.hamcrest.CoreMatchers; | |||
import org.junit.Test; | |||
import org.sonar.wsclient.services.Profile; | |||
@@ -47,7 +46,7 @@ public class ProfileUnmarshallerTest extends UnmarshallerTestCase { | |||
Profile.Rule rule1 = profile.getRules().get(0); | |||
assertThat(rule1.getKey(), is("com.puppycrawl.tools.checkstyle.checks.coding.InnerAssignmentCheck")); | |||
assertThat(rule1.getRepository(), is("checkstyle")); | |||
assertThat(rule1.getInheritance(), CoreMatchers.<Object>nullValue()); | |||
assertThat(rule1.getInheritance(), nullValue()); | |||
assertThat(rule1.getSeverity(), is("MAJOR")); | |||
assertThat(rule1.getParameters().size(), is(0)); | |||
assertThat(rule1.getParameter("foo"), nullValue()); |