I have a method which is removing the trim box from a pdf file. Given a path argument to the method I annotate it with a JetBrains' "@NotNull" annotation:
Path removeTrimBox(@NotNull Path pdfPath) {
if (!Files.exists(pdfPath)) {
throw new IllegalArgumentException(myErrorMessage);
}
// code removing the trim box follows
}
I also have a unit test for this method which expects an IllegalArgumentException:
@Test(expected = IllegalArgumentException.class)
public void removeTrimboxNull() throws Exception {
PdfTools.removeTrimbox(null);
}
Though my checkstyle complains about passing null argument to paramater annotated with NotNull the test runs successfully. The problem is after I push the code to the bamboo server the build runs red with the message: How should I 'teach' my bamboo server to understand this JetBrains annotation?
java.lang.Exception: Unexpected exception, expected "java.lang.IllegalArgumentException" but was "java.lang.NullPointerException".
Should I 'teach' my bamboo server to understand this JetBrains annotation?
EDIT
Here is the pom:
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>13.0</version>
</dependency>
EDIT2
Using Maven's 'test' cycle to run the test causes no NPE, while bamboo is still complaining. I use Intellij IDEA 14.1.4 and maven 3.2.3.