Commit 4a30c739 authored by Eric Bruneton's avatar Eric Bruneton
Browse files

Add tests for the IllegalArgumentException message.

parent e1d376d0
......@@ -126,7 +126,8 @@ class TypeTest implements Opcodes {
void testGetTypeFromDescriptor_invalid() {
Executable getType = () -> Type.getType("-");
assertThrows(IllegalArgumentException.class, getType);
IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, getType);
assertEquals("Invalid descriptor: -", exception.getMessage());
}
@ParameterizedTest
......@@ -187,6 +188,15 @@ class TypeTest implements Opcodes {
Duration.ofMillis(100), () -> assertThrows(RuntimeException.class, getArgumentTypes));
}
@Test
void testGetArgumentTypesInvalidArgumentDescriptor() {
Executable getArgumentTypes = () -> Type.getArgumentTypes("(Ljava/lang/String;-)V");
IllegalArgumentException exception =
assertThrows(IllegalArgumentException.class, getArgumentTypes);
assertEquals("Invalid descriptor: (Ljava/lang/String;-)V", exception.getMessage());
}
@Test
void testGetReturnTypeFromDescriptor() {
assertEquals(Type.INT_TYPE, Type.getReturnType("()I"));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment