Skip to content

Commit

Permalink
Merge pull request WorksApplications#20 from eller86/improve-coverage
Browse files Browse the repository at this point in the history
Improve coverage
  • Loading branch information
wliyongfeng committed Apr 11, 2014
2 parents a74ff2e + 9cd2a17 commit 43659eb
Show file tree
Hide file tree
Showing 12 changed files with 77 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
language: java
jdk:
- openjdk6
- openjdk7
script: "mvn clean install"
after_success:
- mvn clean test jacoco:report coveralls:jacoco
notifications:
email:
recipients:
- [email protected]
- [email protected]
- [email protected]
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ To use this product, please configure your findbugs-maven-plugin like below.
<plugin>
<groupId>jp.co.worksap.oss</groupId>
<artifactId>findbugs-plugin</artifactId>
<version>0.0.2</version>
<version>0.0.3-SNAPSHOT</version>
</plugin>
</plugins>
</configuration>
Expand All @@ -27,6 +27,10 @@ To use this product, please configure your findbugs-maven-plugin like below.

# history

## 0.0.3

- upgraded JDK from 1.6 to 1.7

## 0.0.2

- added BrokenImmutableClassDetector
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<source>1.7</source>
<target>1.7</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ private TypeQualifierAnnotation findDefaultAnnotation(XMethod xMethod,
} else {
return null;
}
} catch (SecurityException e) {
throw new IllegalStateException(e);
} catch (IllegalAccessException e) {
} catch (SecurityException | IllegalAccessException e) {
throw new IllegalStateException(e);
} catch (InvocationTargetException e) {
throw new IllegalArgumentException(e);
Expand All @@ -93,9 +91,7 @@ private void detectUnknowNullnessOfReturnedValue(Method method,
.getDeclaredMethod("getDefaultAnnotation",
AnnotatedObject.class, TypeQualifierValue.class, ElementType.class);
GET_DEFAULT_ANNOTATION.setAccessible(true);
} catch (SecurityException e) {
throw new IllegalStateException(e);
} catch (NoSuchMethodException e) {
} catch (SecurityException | NoSuchMethodException e) {
throw new IllegalStateException(e);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package jp.co.worksap.oss.findbugs.jpa;

import javax.persistence.Column;
import javax.persistence.Lob;

public class GetterWithLongLengthAndLob {
private String name;

@Lob
@Column(length = 10000)
public String getName() {
return name;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package jp.co.worksap.oss.findbugs.jpa;

import javax.persistence.Column;

public class GetterWithTooLongLength {
private String name;

@Column(length = 10000)
public String getName() {
return name;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package jp.co.worksap.oss.findbugs.jpa;

import javax.persistence.Column;

public class GetterWithoutElement {
private String name;

@Column
public String getName() {
return name;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,16 @@ public void testNegativeLength() throws Exception {
public void testTooLongLength() throws Exception {
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);
}

@Test
Expand All @@ -48,5 +52,7 @@ public void testExplicitLength() throws Exception {
public void testImplicitLength() throws Exception {
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
Expand Up @@ -29,5 +29,7 @@ public void testExplicitNullness() throws Exception {
public void testImplicitNullness() throws Exception {
assertBugReported(ColumnWithoutElement.class, detector,
bugReporter);
assertBugReported(GetterWithoutElement.class, detector,
bugReporter);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package jp.co.worksap.oss.findbugs.jpa;

import javax.persistence.Column;
import javax.persistence.Entity;

@Entity
public class NullableBooleanGetter {
private boolean booleanValue;

@Column(nullable = true)
public boolean isBooleanValue() {
return booleanValue;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ public void before() {
@Test
public void testNullableObject() throws Exception {
assertNoBugsReported(UseColumnDefinition.class, detector, bugReporter);
assertNoBugsReported(ColumnWithoutElement.class, detector, bugReporter);
}

@Test
public void testNullableInt() throws Exception {
public void testNullablePrimitive() throws Exception {
assertBugReported(NullableBooleanColumn.class, detector,
bugReporter, ofType("NULLABLE_PRIMITIVE"));
assertBugReported(NullableByteColumn.class, detector,
Expand All @@ -41,6 +42,8 @@ public void testNullableInt() throws Exception {
bugReporter, ofType("NULLABLE_PRIMITIVE"));
assertBugReported(NullableDoubleColumn.class, detector,
bugReporter, ofType("NULLABLE_PRIMITIVE"));
assertBugReported(NullableBooleanGetter.class, detector,
bugReporter, ofType("NULLABLE_PRIMITIVE"));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package jp.co.worksap.oss.findbugs.jsr305;

import javax.annotation.concurrent.Immutable;
import javax.annotation.concurrent.NotThreadSafe;

@NotThreadSafe
@Immutable // marked as immutable, but field is not final
public class MutableClass {
public String value;
Expand Down

0 comments on commit 43659eb

Please sign in to comment.