diff options
author | Glavo <zjx001202@126.com> | 2019-12-06 03:42:00 +0800 |
---|---|---|
committer | Glavo <zjx001202@126.com> | 2019-12-06 03:42:00 +0800 |
commit | e48c0668029849af07d1966729c5b703e89b1d00 (patch) | |
tree | fec378e2c6e52d86e601f0df45ba13728003fa2b /src/test/java/org/glavo/javah/NativeMethodTests.java | |
parent | 6fd5804e3f2c337839efcf5c10426faed1d8b1af (diff) | |
download | gjavah-e48c0668029849af07d1966729c5b703e89b1d00.tar.gz gjavah-e48c0668029849af07d1966729c5b703e89b1d00.tar.bz2 gjavah-e48c0668029849af07d1966729c5b703e89b1d00.zip |
update
Diffstat (limited to 'src/test/java/org/glavo/javah/NativeMethodTests.java')
-rw-r--r-- | src/test/java/org/glavo/javah/NativeMethodTests.java | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/test/java/org/glavo/javah/NativeMethodTests.java b/src/test/java/org/glavo/javah/NativeMethodTests.java new file mode 100644 index 0000000..32251f9 --- /dev/null +++ b/src/test/java/org/glavo/javah/NativeMethodTests.java @@ -0,0 +1,34 @@ +package org.glavo.javah; + +import org.junit.jupiter.api.Test; +import org.objectweb.asm.Type; + +import java.util.LinkedHashMap; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.*; + +public class NativeMethodTests { + @Test + void testFactoryMethod() { + Map<String, Type> qualified = new LinkedHashMap<>() { + { + put("method0", Type.getType("()I")); + put("method1", Type.getType("(Ljava/lang/String;)I")); + } + }; + + Map<String, Type> wrongs = new LinkedHashMap<>() { + { + put("method0", Type.getType(String.class)); + put("method1", Type.getType("()")); + put("method2", Type.getType("L;")); + } + }; + + qualified.forEach((name, type) -> assertDoesNotThrow(() -> NativeMethod.of(name, type))); + wrongs.forEach((name, type) -> assertThrows(IllegalArgumentException.class, () -> NativeMethod.of(name, type))); + + + } +} |