@NotNull instrumentation: added test for duplicated labels in tableswitch instruction (IDEA-CR-11417)

This commit is contained in:
nik
2016-06-20 21:49:34 +03:00
parent 4ed85d93be
commit fd03434cfd
2 changed files with 30 additions and 0 deletions
@@ -0,0 +1,19 @@
import org.jetbrains.annotations.NotNull;
public class MultipleMessages {
@NotNull
public Object foo1() {
return null;
}
@NotNull
public Object foo2() {
return null;
}
public void bar1(@NotNull Object a) {
}
public void bar2(@NotNull Object b) {
}
}
@@ -162,6 +162,17 @@ public class NotNullVerifyingInstrumenterTest extends UsefulTestCase {
}
}
public void testMultipleMessages() throws Exception {
Class<?> test = prepareTest();
Object instance = test.newInstance();
verifyCallThrowsException("Argument 0 for @NotNull parameter of MultipleMessages.bar1 must not be null", instance, test.getMethod("bar1", Object.class),
(Object)null);
verifyCallThrowsException("Argument 0 for @NotNull parameter of MultipleMessages.bar2 must not be null", instance, test.getMethod("bar2", Object.class),
(Object)null);
verifyCallThrowsException("@NotNull method MultipleMessages.foo1 must not return null", instance, test.getMethod("foo1"));
verifyCallThrowsException("@NotNull method MultipleMessages.foo2 must not return null", instance, test.getMethod("foo2"));
}
public void testMalformedBytecode() throws Exception {
Class<?> testClass = prepareTest(false);
verifyCallThrowsException("Argument 0 for @NotNull parameter of MalformedBytecode$NullTest2.handle must not be null", null, testClass.getMethod("main"));