Browse Source

Fic compatibility of hamcrest with java 6

tags/4.4-RC1
Simon Brandhof 10 years ago
parent
commit
5b06f60c16

+ 3
- 2
sonar-duplications/src/test/java/org/sonar/duplications/detector/CloneGroupMatcher.java View File

@@ -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;

+ 2
- 3
sonar-plugin-api/src/test/java/org/sonar/api/batch/bootstrap/ProjectDefinitionTest.java View File

@@ -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

+ 1
- 1
sonar-plugin-api/src/test/java/org/sonar/api/utils/FieldUtils2Test.java View File

@@ -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 {


+ 1
- 2
sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ProfileUnmarshallerTest.java View File

@@ -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());

Loading…
Cancel
Save