Skip to content

Commit

Permalink
- test-driven-detectors4findbugs returned in the POM-File
Browse files Browse the repository at this point in the history
- Tests using test-driven-detectors4findbugs are commented in, but
ignored (!) 
- the reason for this: 
	- test-driven-detectors4findbugs does not work with FB3.0
	- Ignored tests are still better as commented-out ones
  • Loading branch information
wojtus committed Jan 5, 2015
1 parent bc1ecbd commit f920b70
Show file tree
Hide file tree
Showing 13 changed files with 154 additions and 122 deletions.
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,12 @@
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.youdevise</groupId>
<artifactId>test-driven-detectors4findbugs</artifactId>
<version>0.2.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>findbugs</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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"));
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,35 @@
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;
private ColumnDefinitionDetector detector;

@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"));
}
}
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -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"));
}
}
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -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);
}
}
Loading

0 comments on commit f920b70

Please sign in to comment.