diff --git a/pom.xml b/pom.xml index b3afaf2..dae25ce 100644 --- a/pom.xml +++ b/pom.xml @@ -152,6 +152,12 @@ + + com.youdevise + test-driven-detectors4findbugs + 0.2.1 + test + com.google.code.findbugs findbugs diff --git a/src/test/java/jp/co/worksap/oss/findbugs/ForbiddenSystemDetectorTest.java b/src/test/java/jp/co/worksap/oss/findbugs/ForbiddenSystemDetectorTest.java index deef1b2..74caad8 100644 --- a/src/test/java/jp/co/worksap/oss/findbugs/ForbiddenSystemDetectorTest.java +++ b/src/test/java/jp/co/worksap/oss/findbugs/ForbiddenSystemDetectorTest.java @@ -3,23 +3,27 @@ import org.junit.Ignore; import org.junit.Test; -@Ignore("test-driven-detectors4findbugs dependency is removed") +import com.youdevise.fbplugins.tdd4fb.DetectorAssert; + +import edu.umd.cs.findbugs.BugReporter; + +@Ignore("test-driven-detectors4findbugs is not compatible with FB3.0") public class ForbiddenSystemDetectorTest { @Test public void testUseSystemOutBug() throws Exception { - // BugReporter bugReporter = DetectorAssert.bugReporterForTesting(); - // ForbiddenSystemClass detector = new ForbiddenSystemClass(bugReporter); - // - // DetectorAssert.assertBugReported(UseSystemOut.class, detector, bugReporter); + BugReporter bugReporter = DetectorAssert.bugReporterForTesting(); + ForbiddenSystemClass detector = new ForbiddenSystemClass(bugReporter); + + DetectorAssert.assertBugReported(UseSystemOut.class, detector, bugReporter); } @Test public void testUseSystemErrBug() throws Exception { - // BugReporter bugReporter = DetectorAssert.bugReporterForTesting(); - // ForbiddenSystemClass detector = new ForbiddenSystemClass(bugReporter); - // - // DetectorAssert.assertBugReported(UseSystemErr.class, detector, bugReporter); + BugReporter bugReporter = DetectorAssert.bugReporterForTesting(); + ForbiddenSystemClass detector = new ForbiddenSystemClass(bugReporter); + + DetectorAssert.assertBugReported(UseSystemErr.class, detector, bugReporter); } } diff --git a/src/test/java/jp/co/worksap/oss/findbugs/guava/UnexpectedAccessDetectorTest.java b/src/test/java/jp/co/worksap/oss/findbugs/guava/UnexpectedAccessDetectorTest.java index f7dbe82..10b246f 100644 --- a/src/test/java/jp/co/worksap/oss/findbugs/guava/UnexpectedAccessDetectorTest.java +++ b/src/test/java/jp/co/worksap/oss/findbugs/guava/UnexpectedAccessDetectorTest.java @@ -19,7 +19,6 @@ import org.apache.bcel.classfile.JavaClass; import org.apache.bcel.classfile.Method; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; @@ -45,24 +44,11 @@ public class UnexpectedAccessDetectorTest { private BugReporter bugReporter; /** - * + * Init */ @Before public void initMocks() { MockitoAnnotations.initMocks(this); - // bugReporter = bugReporterForTesting(); - } - - @Test - @Ignore - public void testNormalMethod() throws Exception { - //assertNoBugsReported(ClassWhichCallsNormalMethod.class, detector, bugReporter); - } - - @Test - @Ignore - public void testCallingAnnotatedMethod() throws Exception { - // assertBugReported(ClassWhichCallsVisibleMethodForTesting.class, detector, bugReporter, ofType("GUAVA_UNEXPECTED_ACCESS_TO_VISIBLE_FOR_TESTING")); } /** diff --git a/src/test/java/jp/co/worksap/oss/findbugs/jpa/ColumnDefinitionTest.java b/src/test/java/jp/co/worksap/oss/findbugs/jpa/ColumnDefinitionTest.java index 40a33f9..f75fef9 100644 --- a/src/test/java/jp/co/worksap/oss/findbugs/jpa/ColumnDefinitionTest.java +++ b/src/test/java/jp/co/worksap/oss/findbugs/jpa/ColumnDefinitionTest.java @@ -1,12 +1,17 @@ package jp.co.worksap.oss.findbugs.jpa; +import static com.youdevise.fbplugins.tdd4fb.DetectorAssert.assertBugReported; +import static com.youdevise.fbplugins.tdd4fb.DetectorAssert.assertNoBugsReported; +import static com.youdevise.fbplugins.tdd4fb.DetectorAssert.bugReporterForTesting; +import static com.youdevise.fbplugins.tdd4fb.DetectorAssert.ofType; + import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import edu.umd.cs.findbugs.BugReporter; -@Ignore("test-driven-detectors4findbugs dependency is removed") +@Ignore("test-driven-detectors4findbugs is not compatible with FB3.0") public class ColumnDefinitionTest { private BugReporter bugReporter; @@ -14,17 +19,17 @@ public class ColumnDefinitionTest { @Before public void setup() { - // bugReporter = bugReporterForTesting(); - // detector = new ColumnDefinitionDetector(bugReporter); + bugReporter = bugReporterForTesting(); + detector = new ColumnDefinitionDetector(bugReporter); } @Test public void testNormalClass() throws Exception { - // assertNoBugsReported(ShortColumnName.class, detector, bugReporter); + assertNoBugsReported(ShortColumnName.class, detector, bugReporter); } @Test public void testWithColumnDefinition() throws Exception { - // assertBugReported(UseColumnDefinition.class, detector, bugReporter, ofType("USE_COLUMN_DEFINITION")); + assertBugReported(UseColumnDefinition.class, detector, bugReporter, ofType("USE_COLUMN_DEFINITION")); } } diff --git a/src/test/java/jp/co/worksap/oss/findbugs/jpa/ColumnNameLengthTest.java b/src/test/java/jp/co/worksap/oss/findbugs/jpa/ColumnNameLengthTest.java index 234840d..1855b4c 100755 --- a/src/test/java/jp/co/worksap/oss/findbugs/jpa/ColumnNameLengthTest.java +++ b/src/test/java/jp/co/worksap/oss/findbugs/jpa/ColumnNameLengthTest.java @@ -1,44 +1,48 @@ package jp.co.worksap.oss.findbugs.jpa; +import static com.youdevise.fbplugins.tdd4fb.DetectorAssert.assertBugReported; +import static com.youdevise.fbplugins.tdd4fb.DetectorAssert.assertNoBugsReported; +import static com.youdevise.fbplugins.tdd4fb.DetectorAssert.bugReporterForTesting; + import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import edu.umd.cs.findbugs.BugReporter; -@Ignore("test-driven-detectors4findbugs dependency is removed") +@Ignore("test-driven-detectors4findbugs is not compatible with FB3.0") public class ColumnNameLengthTest { private BugReporter bugReporter; private LongColumnNameDetector detector; @Before public void setup() { - // bugReporter = bugReporterForTesting(); - // detector = new LongColumnNameDetector(bugReporter); + bugReporter = bugReporterForTesting(); + detector = new LongColumnNameDetector(bugReporter); } @Test public void testShortName() throws Exception { - // assertNoBugsReported(ShortColumnName.class, detector, bugReporter); + assertNoBugsReported(ShortColumnName.class, detector, bugReporter); } @Test public void testShortNameWithoutAnnotationParameter() throws Exception { - // assertNoBugsReported(ShortColumnNameWithoutAnnotationParameter.class, detector, bugReporter); + assertNoBugsReported(ShortColumnNameWithoutAnnotationParameter.class, detector, bugReporter); } @Test public void testLongName() throws Exception { - // assertBugReported(LongColumnName.class, detector, bugReporter); + assertBugReported(LongColumnName.class, detector, bugReporter); } @Test public void testLongNameWithoutAnnotationParameter() throws Exception { - // assertBugReported(LongColumnNameWithoutAnnotationParameter.class, detector, bugReporter); + assertBugReported(LongColumnNameWithoutAnnotationParameter.class, detector, bugReporter); } @Test public void testLongColumnNameByAnnotatedMethod() throws Exception { - // assertBugReported(LongColumnNameByAnnotatedMethod.class, detector, bugReporter); + assertBugReported(LongColumnNameByAnnotatedMethod.class, detector, bugReporter); } } diff --git a/src/test/java/jp/co/worksap/oss/findbugs/jpa/ImplicitLengthTest.java b/src/test/java/jp/co/worksap/oss/findbugs/jpa/ImplicitLengthTest.java index 410db1b..2563b88 100644 --- a/src/test/java/jp/co/worksap/oss/findbugs/jpa/ImplicitLengthTest.java +++ b/src/test/java/jp/co/worksap/oss/findbugs/jpa/ImplicitLengthTest.java @@ -1,50 +1,52 @@ package jp.co.worksap.oss.findbugs.jpa; +import static com.youdevise.fbplugins.tdd4fb.DetectorAssert.assertBugReported; +import static com.youdevise.fbplugins.tdd4fb.DetectorAssert.assertNoBugsReported; +import static com.youdevise.fbplugins.tdd4fb.DetectorAssert.bugReporterForTesting; +import static com.youdevise.fbplugins.tdd4fb.DetectorAssert.ofType; + import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import edu.umd.cs.findbugs.BugReporter; -@Ignore("test-driven-detectors4findbugs dependency is removed") +@Ignore("test-driven-detectors4findbugs is not compatible with FB3.0") public class ImplicitLengthTest { private BugReporter bugReporter; private ImplicitLengthDetector detector; @Before public void before() { - // this.bugReporter = bugReporterForTesting(); - // this.detector = new ImplicitLengthDetector(bugReporter); + bugReporter = bugReporterForTesting(); + detector = new ImplicitLengthDetector(bugReporter); } @Test public void testNegativeLength() throws Exception { - // assertBugReported(ColumnWithNegativeLength.class, detector, - // bugReporter, ofType("ILLEGAL_LENGTH")); + assertBugReported(ColumnWithNegativeLength.class, detector, bugReporter, ofType("ILLEGAL_LENGTH")); } @Test public void testTooLongLength() throws Exception { - // assertBugReported(ColumnWithTooLongLength.class, detector, - // bugReporter, ofType("ILLEGAL_LENGTH")); - // assertBugReported(GetterWithTooLongLength.class, detector, - // bugReporter, ofType("ILLEGAL_LENGTH")); + assertBugReported(ColumnWithTooLongLength.class, detector, bugReporter, ofType("ILLEGAL_LENGTH")); + assertBugReported(GetterWithTooLongLength.class, detector, bugReporter, ofType("ILLEGAL_LENGTH")); } @Test public void testLongLengthWithLob() throws Exception { - // assertNoBugsReported(ColumnWithLongLengthAndLob.class, detector, bugReporter); - // assertNoBugsReported(GetterWithLongLengthAndLob.class, detector, bugReporter); + assertNoBugsReported(ColumnWithLongLengthAndLob.class, detector, bugReporter); + assertNoBugsReported(GetterWithLongLengthAndLob.class, detector, bugReporter); } @Test public void testExplicitLength() throws Exception { - // assertNoBugsReported(ColumnWithLength.class, detector, bugReporter); + assertNoBugsReported(ColumnWithLength.class, detector, bugReporter); } @Test public void testImplicitLength() throws Exception { - // assertBugReported(ColumnWithoutElement.class, detector, bugReporter, ofType("IMPLICIT_LENGTH")); - // assertBugReported(GetterWithoutElement.class, detector, bugReporter, ofType("IMPLICIT_LENGTH")); + assertBugReported(ColumnWithoutElement.class, detector, bugReporter, ofType("IMPLICIT_LENGTH")); + assertBugReported(GetterWithoutElement.class, detector, bugReporter, ofType("IMPLICIT_LENGTH")); } } diff --git a/src/test/java/jp/co/worksap/oss/findbugs/jpa/ImplicitNullnessTest.java b/src/test/java/jp/co/worksap/oss/findbugs/jpa/ImplicitNullnessTest.java index 0e1024e..373956c 100644 --- a/src/test/java/jp/co/worksap/oss/findbugs/jpa/ImplicitNullnessTest.java +++ b/src/test/java/jp/co/worksap/oss/findbugs/jpa/ImplicitNullnessTest.java @@ -1,30 +1,34 @@ package jp.co.worksap.oss.findbugs.jpa; +import static com.youdevise.fbplugins.tdd4fb.DetectorAssert.assertBugReported; +import static com.youdevise.fbplugins.tdd4fb.DetectorAssert.assertNoBugsReported; +import static com.youdevise.fbplugins.tdd4fb.DetectorAssert.bugReporterForTesting; + import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import edu.umd.cs.findbugs.BugReporter; -@Ignore("test-driven-detectors4findbugs dependency is removed") +@Ignore("test-driven-detectors4findbugs is not compatible with FB3.0") public class ImplicitNullnessTest { private BugReporter bugReporter; private ImplicitNullnessDetector detector; @Before public void before() { - // bugReporter = bugReporterForTesting(); - // detector = new ImplicitNullnessDetector(bugReporter); + bugReporter = bugReporterForTesting(); + detector = new ImplicitNullnessDetector(bugReporter); } @Test public void testExplicitNullness() throws Exception { - // assertNoBugsReported(ColumnWithNullable.class, detector, bugReporter); + assertNoBugsReported(ColumnWithNullable.class, detector, bugReporter); } @Test public void testImplicitNullness() throws Exception { - // assertBugReported(ColumnWithoutElement.class, detector, bugReporter); - // assertBugReported(GetterWithoutElement.class, detector, bugReporter); + assertBugReported(ColumnWithoutElement.class, detector, bugReporter); + assertBugReported(GetterWithoutElement.class, detector, bugReporter); } } diff --git a/src/test/java/jp/co/worksap/oss/findbugs/jpa/IndexNameLengthTest.java b/src/test/java/jp/co/worksap/oss/findbugs/jpa/IndexNameLengthTest.java index befd77f..9c8add6 100755 --- a/src/test/java/jp/co/worksap/oss/findbugs/jpa/IndexNameLengthTest.java +++ b/src/test/java/jp/co/worksap/oss/findbugs/jpa/IndexNameLengthTest.java @@ -1,39 +1,43 @@ package jp.co.worksap.oss.findbugs.jpa; +import static com.youdevise.fbplugins.tdd4fb.DetectorAssert.assertBugReported; +import static com.youdevise.fbplugins.tdd4fb.DetectorAssert.assertNoBugsReported; +import static com.youdevise.fbplugins.tdd4fb.DetectorAssert.bugReporterForTesting; + import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import edu.umd.cs.findbugs.BugReporter; -@Ignore("test-driven-detectors4findbugs dependency is removed") +@Ignore("test-driven-detectors4findbugs is not compatible with FB3.0") public class IndexNameLengthTest { private BugReporter bugReporter; private LongIndexNameDetector detector; @Before public void setup() { - // bugReporter = bugReporterForTesting(); - // detector = new LongIndexNameDetector(bugReporter); + bugReporter = bugReporterForTesting(); + detector = new LongIndexNameDetector(bugReporter); } @Test public void testShortNameWithHibernate() throws Exception { - // assertNoBugsReported(ShortIndexNameForHibernate.class, detector, bugReporter); + assertNoBugsReported(ShortIndexNameForHibernate.class, detector, bugReporter); } @Test public void testLongNameWithHibernate() throws Exception { - // assertBugReported(LongIndexNameForHibernate.class, detector, bugReporter); + assertBugReported(LongIndexNameForHibernate.class, detector, bugReporter); } @Test public void testShortNameWithOpenJPA() throws Exception { - // assertNoBugsReported(ShortIndexNameForOpenJPA.class, detector, bugReporter); + assertNoBugsReported(ShortIndexNameForOpenJPA.class, detector, bugReporter); } @Test public void testLongNameWithOpenJPA() throws Exception { - // assertBugReported(LongIndexNameForOpenJPA.class, detector, bugReporter); + assertBugReported(LongIndexNameForOpenJPA.class, detector, bugReporter); } } diff --git a/src/test/java/jp/co/worksap/oss/findbugs/jpa/NullablePrimitiveDetectorTest.java b/src/test/java/jp/co/worksap/oss/findbugs/jpa/NullablePrimitiveDetectorTest.java index 37309bf..d4967a8 100644 --- a/src/test/java/jp/co/worksap/oss/findbugs/jpa/NullablePrimitiveDetectorTest.java +++ b/src/test/java/jp/co/worksap/oss/findbugs/jpa/NullablePrimitiveDetectorTest.java @@ -1,56 +1,53 @@ package jp.co.worksap.oss.findbugs.jpa; +import static com.youdevise.fbplugins.tdd4fb.DetectorAssert.assertBugReported; +import static com.youdevise.fbplugins.tdd4fb.DetectorAssert.assertNoBugsReported; +import static com.youdevise.fbplugins.tdd4fb.DetectorAssert.bugReporterForTesting; +import static com.youdevise.fbplugins.tdd4fb.DetectorAssert.ofType; + import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import edu.umd.cs.findbugs.BugReporter; -@Ignore("test-driven-detectors4findbugs dependency is removed") +@Ignore("test-driven-detectors4findbugs is not compatible with FB3.0") public class NullablePrimitiveDetectorTest { private BugReporter bugReporter; private NullablePrimitiveDetector detector; @Before public void before() { - // this.bugReporter = bugReporterForTesting(); - // this.detector = new NullablePrimitiveDetector(bugReporter); + bugReporter = bugReporterForTesting(); + detector = new NullablePrimitiveDetector(bugReporter); } @Test public void testNullableObject() throws Exception { - // assertNoBugsReported(UseColumnDefinition.class, detector, bugReporter); - // assertNoBugsReported(ColumnWithoutElement.class, detector, bugReporter); + assertNoBugsReported(UseColumnDefinition.class, detector, bugReporter); + assertNoBugsReported(ColumnWithoutElement.class, detector, bugReporter); } @Test public void testNullablePrimitive() throws Exception { - // assertBugReported(NullableBooleanColumn.class, detector, - // bugReporter, ofType("NULLABLE_PRIMITIVE")); - // assertBugReported(NullableByteColumn.class, detector, - // bugReporter, ofType("NULLABLE_PRIMITIVE")); - // assertBugReported(NullableShortColumn.class, detector, - // bugReporter, ofType("NULLABLE_PRIMITIVE")); - // assertBugReported(NullableIntColumn.class, detector, - // bugReporter, ofType("NULLABLE_PRIMITIVE")); - // assertBugReported(NullableLongColumn.class, detector, - // bugReporter, ofType("NULLABLE_PRIMITIVE")); - // assertBugReported(NullableFloatColumn.class, detector, - // bugReporter, ofType("NULLABLE_PRIMITIVE")); - // assertBugReported(NullableDoubleColumn.class, detector, - // bugReporter, ofType("NULLABLE_PRIMITIVE")); - // assertBugReported(NullableBooleanGetter.class, detector, - // bugReporter, ofType("NULLABLE_PRIMITIVE")); + assertBugReported(NullableBooleanColumn.class, detector, bugReporter, ofType("NULLABLE_PRIMITIVE")); + assertBugReported(NullableByteColumn.class, detector, bugReporter, ofType("NULLABLE_PRIMITIVE")); + assertBugReported(NullableShortColumn.class, detector, bugReporter, ofType("NULLABLE_PRIMITIVE")); + assertBugReported(NullableIntColumn.class, detector, bugReporter, ofType("NULLABLE_PRIMITIVE")); + assertBugReported(NullableLongColumn.class, detector, bugReporter, ofType("NULLABLE_PRIMITIVE")); + assertBugReported(NullableFloatColumn.class, detector, bugReporter, ofType("NULLABLE_PRIMITIVE")); + assertBugReported(NullableDoubleColumn.class, detector, bugReporter, ofType("NULLABLE_PRIMITIVE")); + assertBugReported(NullableBooleanGetter.class, detector, bugReporter, ofType("NULLABLE_PRIMITIVE")); } @Test public void testNonNullableObject() throws Exception { - // assertNoBugsReported(ColumnWithNullable.class, detector, bugReporter); + assertNoBugsReported(ColumnWithNullable.class, detector, bugReporter); } @Test public void testNonNullableInt() throws Exception { - // assertNoBugsReported(NonNullablePrimitiveColumn.class, detector, bugReporter); + assertNoBugsReported(NonNullablePrimitiveColumn.class, detector, bugReporter); } } diff --git a/src/test/java/jp/co/worksap/oss/findbugs/jpa/TableNameLengthTest.java b/src/test/java/jp/co/worksap/oss/findbugs/jpa/TableNameLengthTest.java index 16bc45c..3376e63 100644 --- a/src/test/java/jp/co/worksap/oss/findbugs/jpa/TableNameLengthTest.java +++ b/src/test/java/jp/co/worksap/oss/findbugs/jpa/TableNameLengthTest.java @@ -1,5 +1,8 @@ package jp.co.worksap.oss.findbugs.jpa; +import static com.youdevise.fbplugins.tdd4fb.DetectorAssert.assertBugReported; +import static com.youdevise.fbplugins.tdd4fb.DetectorAssert.assertNoBugsReported; +import static com.youdevise.fbplugins.tdd4fb.DetectorAssert.bugReporterForTesting; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; @@ -10,35 +13,35 @@ import edu.umd.cs.findbugs.BugReporter; -@Ignore("test-driven-detectors4findbugs dependency is removed") +@Ignore("test-driven-detectors4findbugs is not compatible with FB3.0") public class TableNameLengthTest { private BugReporter bugReporter; private LongTableNameDetector detector; @Before public void setup() { - // bugReporter = bugReporterForTesting(); - // detector = new LongTableNameDetector(bugReporter); + bugReporter = bugReporterForTesting(); + detector = new LongTableNameDetector(bugReporter); } @Test public void testShortName() throws Exception { - // assertNoBugsReported(ShortTableName.class, detector, bugReporter); + assertNoBugsReported(ShortTableName.class, detector, bugReporter); } @Test public void testShortNameWithoutAnnotationParameter() throws Exception { - // assertNoBugsReported(ShortTableNameNoAnnotationPara.class, detector, bugReporter); + assertNoBugsReported(ShortTableNameNoAnnotationPara.class, detector, bugReporter); } @Test public void testLongName() throws Exception { - // assertBugReported(LongTableName.class, detector, bugReporter); + assertBugReported(LongTableName.class, detector, bugReporter); } @Test public void testLongNameWithoutAnnotationParameter() throws Exception { - // assertBugReported(LongTableNameWithoutAnnotationParameter.class, detector, bugReporter); + assertBugReported(LongTableNameWithoutAnnotationParameter.class, detector, bugReporter); } @Test diff --git a/src/test/java/jp/co/worksap/oss/findbugs/jsr305/BrokenImmutableClassDetectorTest.java b/src/test/java/jp/co/worksap/oss/findbugs/jsr305/BrokenImmutableClassDetectorTest.java index 2dc3164..0b2d586 100755 --- a/src/test/java/jp/co/worksap/oss/findbugs/jsr305/BrokenImmutableClassDetectorTest.java +++ b/src/test/java/jp/co/worksap/oss/findbugs/jsr305/BrokenImmutableClassDetectorTest.java @@ -1,12 +1,19 @@ package jp.co.worksap.oss.findbugs.jsr305; +import static com.youdevise.fbplugins.tdd4fb.DetectorAssert.assertBugReported; +import static com.youdevise.fbplugins.tdd4fb.DetectorAssert.assertNoBugsReported; +import static com.youdevise.fbplugins.tdd4fb.DetectorAssert.bugReporterForTesting; +import static com.youdevise.fbplugins.tdd4fb.DetectorAssert.ofType; + +import javax.annotation.meta.When; + import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import edu.umd.cs.findbugs.BugReporter; -@Ignore("test-driven-detectors4findbugs dependency is removed") +@Ignore("test-driven-detectors4findbugs is not compatible with FB3.0") public class BrokenImmutableClassDetectorTest { private BrokenImmutableClassDetector detector; @@ -14,28 +21,28 @@ public class BrokenImmutableClassDetectorTest { @Before public void setup() { - // bugReporter = bugReporterForTesting(); - // detector = new BrokenImmutableClassDetector(bugReporter); + bugReporter = bugReporterForTesting(); + detector = new BrokenImmutableClassDetector(bugReporter); } @Test public void testObjectIsImmutable() throws Exception { - // assertNoBugsReported(Object.class, detector, bugReporter); + assertNoBugsReported(Object.class, detector, bugReporter); } @Test public void testEnumIsImmutable() throws Exception { - // assertNoBugsReported(When.class, detector, bugReporter); + assertNoBugsReported(When.class, detector, bugReporter); } @Test public void testMutableClass() throws Exception { - // assertBugReported(MutableClass.class, detector, bugReporter, ofType("IMMUTABLE_CLASS_SHOULD_BE_FINAL")); - // assertBugReported(MutableClass.class, detector, bugReporter, ofType("BROKEN_IMMUTABILITY")); + assertBugReported(MutableClass.class, detector, bugReporter, ofType("IMMUTABLE_CLASS_SHOULD_BE_FINAL")); + assertBugReported(MutableClass.class, detector, bugReporter, ofType("BROKEN_IMMUTABILITY")); } @Test public void testClassExtendsMutableClass() throws Exception { - // assertBugReported(ExtendsMutableClass.class, detector, bugReporter, ofType("BROKEN_IMMUTABILITY")); + assertBugReported(ExtendsMutableClass.class, detector, bugReporter, ofType("BROKEN_IMMUTABILITY")); } } diff --git a/src/test/java/jp/co/worksap/oss/findbugs/jsr305/nullness/UnknownNullnessDetectorTest.java b/src/test/java/jp/co/worksap/oss/findbugs/jsr305/nullness/UnknownNullnessDetectorTest.java index e1874f8..bd34465 100644 --- a/src/test/java/jp/co/worksap/oss/findbugs/jsr305/nullness/UnknownNullnessDetectorTest.java +++ b/src/test/java/jp/co/worksap/oss/findbugs/jsr305/nullness/UnknownNullnessDetectorTest.java @@ -1,59 +1,64 @@ package jp.co.worksap.oss.findbugs.jsr305.nullness; +import static com.youdevise.fbplugins.tdd4fb.DetectorAssert.assertBugReported; +import static com.youdevise.fbplugins.tdd4fb.DetectorAssert.assertNoBugsReported; +import static com.youdevise.fbplugins.tdd4fb.DetectorAssert.bugReporterForTesting; +import jp.co.worksap.oss.findbugs.jsr305.nullness.annotatedpackage.AnnotatedPackage; + import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import edu.umd.cs.findbugs.BugReporter; -@Ignore("test-driven-detectors4findbugs dependency is removed") +@Ignore("test-driven-detectors4findbugs is not compatible with FB3.0") public class UnknownNullnessDetectorTest { private UnknownNullnessDetector detector; private BugReporter bugReporter; @Before public void setup() { - // bugReporter = bugReporterForTesting(); - // detector = new UnknownNullnessDetector(bugReporter); + bugReporter = bugReporterForTesting(); + detector = new UnknownNullnessDetector(bugReporter); } @Test public void testPrimitive() throws Exception { - // assertNoBugsReported(PrimitiveArgument.class, detector, bugReporter); + assertNoBugsReported(PrimitiveArgument.class, detector, bugReporter); } @Test public void testAnnotatedPackage() throws Exception { - // assertNoBugsReported(AnnotatedPackage.class, detector, bugReporter); + assertNoBugsReported(AnnotatedPackage.class, detector, bugReporter); } @Test public void testAnnotatedClass() throws Exception { - // assertNoBugsReported(AnnotatedClass.class, detector, bugReporter); + assertNoBugsReported(AnnotatedClass.class, detector, bugReporter); } @Test public void testAnnotatedMethod() throws Exception { - // assertNoBugsReported(AnnotatedMethod.class, detector, bugReporter); + assertNoBugsReported(AnnotatedMethod.class, detector, bugReporter); } @Test public void testAnnotatedArgument() throws Exception { - // assertNoBugsReported(AnnotatedArgument.class, detector, bugReporter); + assertNoBugsReported(AnnotatedArgument.class, detector, bugReporter); } @Test public void testNoAnnotation() throws Exception { - // assertBugReported(NoAnnotation.class, detector, bugReporter); + assertBugReported(NoAnnotation.class, detector, bugReporter); } @Test public void testAnnotatedReturnValue() throws Exception { - // assertNoBugsReported(AnnotatedReturnValue.class, detector, bugReporter); + assertNoBugsReported(AnnotatedReturnValue.class, detector, bugReporter); } @Test public void testUnannotatedReturnValue() throws Exception { - // assertBugReported(UnannotatedReturnValue.class, detector, bugReporter); + assertBugReported(UnannotatedReturnValue.class, detector, bugReporter); } } diff --git a/src/test/java/jp/co/worksap/oss/findbugs/junit/UndocumentedIgnoreDetectorTest.java b/src/test/java/jp/co/worksap/oss/findbugs/junit/UndocumentedIgnoreDetectorTest.java index acf382b..b857d13 100755 --- a/src/test/java/jp/co/worksap/oss/findbugs/junit/UndocumentedIgnoreDetectorTest.java +++ b/src/test/java/jp/co/worksap/oss/findbugs/junit/UndocumentedIgnoreDetectorTest.java @@ -1,49 +1,54 @@ package jp.co.worksap.oss.findbugs.junit; +import static com.youdevise.fbplugins.tdd4fb.DetectorAssert.assertBugReported; +import static com.youdevise.fbplugins.tdd4fb.DetectorAssert.assertNoBugsReported; +import static com.youdevise.fbplugins.tdd4fb.DetectorAssert.bugReporterForTesting; + import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import edu.umd.cs.findbugs.BugReporter; -@Ignore("test-driven-detectors4findbugs dependency is removed") + +@Ignore("test-driven-detectors4findbugs is not compatible with FB3.0") public class UndocumentedIgnoreDetectorTest { private UndocumentedIgnoreDetector detector; private BugReporter bugReporter; @Before public void setup() { - // bugReporter = bugReporterForTesting(); - // detector = new UndocumentedIgnoreDetector(bugReporter); + bugReporter = bugReporterForTesting(); + detector = new UndocumentedIgnoreDetector(bugReporter); } @Test public void testIgnoreClassWithExplanation() throws Exception { - // assertNoBugsReported(IgnoreClassWithExplanation.class, detector, bugReporter); + assertNoBugsReported(IgnoreClassWithExplanation.class, detector, bugReporter); } @Test public void testIgnoreMethodWithExplanation() throws Exception { - // assertNoBugsReported(IgnoreMethodWithExplanation.class, detector, bugReporter); + assertNoBugsReported(IgnoreMethodWithExplanation.class, detector, bugReporter); } @Test public void testIgnoreClassWithEmptyExplanation() throws Exception { - // assertBugReported(IgnoreClassWithEmptyExplanation.class, detector, bugReporter); + assertBugReported(IgnoreClassWithEmptyExplanation.class, detector, bugReporter); } @Test public void testIgnoreMethodWithEmptyExplanation() throws Exception { - // assertBugReported(IgnoreMethodWithEmptyExplanation.class, detector, bugReporter); + assertBugReported(IgnoreMethodWithEmptyExplanation.class, detector, bugReporter); } @Test public void testIgnoreClassWithoutExplanation() throws Exception { - // assertBugReported(IgnoreClassWithoutExplanation.class, detector, bugReporter); + assertBugReported(IgnoreClassWithoutExplanation.class, detector, bugReporter); } @Test public void testIgnoreMethodWithoutExplanation() throws Exception { - // assertBugReported(IgnoreMethodWithoutExplanation.class, detector, bugReporter); + assertBugReported(IgnoreMethodWithoutExplanation.class, detector, bugReporter); } }