Improve test, cover cases whith no rule / assert
This commit is contained in:
@ -273,26 +273,26 @@ public class Foo_Test
|
||||
</test-code>
|
||||
<test-code>
|
||||
<description>#285 Issues with @Rule annotation and ExpectedException</description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<expected-problems>1</expected-problems>
|
||||
<expected-linenumbers>7</expected-linenumbers>
|
||||
<code><![CDATA[
|
||||
import org.junit.*;
|
||||
public class SimpleExpectedExceptionTest {
|
||||
@Rule
|
||||
public ExpectedException thrown = ExpectedException.none();
|
||||
@Rule
|
||||
public ExpectedException thrown = ExpectedException.none();
|
||||
|
||||
@Test
|
||||
public void throwsExceptionWithSpecificType() {
|
||||
thrown.expect(NullPointerException.class);
|
||||
throw new NullPointerException();
|
||||
}
|
||||
@Test
|
||||
public void throwsExceptionWithSpecificType() {
|
||||
throw new NullPointerException(); // No expect! this is a violation
|
||||
}
|
||||
|
||||
@Test
|
||||
public void throwsIllegalArgumentExceptionIfIconIsNull() {
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Icon is null, not a file, or doesn't exist.");
|
||||
new DigitalAssetManager(null, null);
|
||||
}
|
||||
}
|
||||
@Test
|
||||
public void throwsIllegalArgumentExceptionIfIconIsNull() {
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Icon is null, not a file, or doesn't exist.");
|
||||
new DigitalAssetManager(null, null);
|
||||
}
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
<test-code>
|
||||
|
Reference in New Issue
Block a user