diff --git a/pom.xml b/pom.xml index 7d619d5..0bbd948 100644 --- a/pom.xml +++ b/pom.xml @@ -31,5 +31,13 @@ + + + junit + junit + 4.12 + test + + \ No newline at end of file diff --git a/src/test/java/cz/adamh/utils/NativeUtilsTest.java b/src/test/java/cz/adamh/utils/NativeUtilsTest.java new file mode 100644 index 0000000..ca1cd02 --- /dev/null +++ b/src/test/java/cz/adamh/utils/NativeUtilsTest.java @@ -0,0 +1,29 @@ +package cz.adamh.utils; + +import java.io.FileNotFoundException; +import java.io.IOException; + +import org.junit.Test; + +public class NativeUtilsTest { + + @Test(expected=IllegalArgumentException.class) + public void testLoadLibraryIllegalPath() throws IOException { + NativeUtils.loadLibraryFromJar("libtest.so"); + } + + @Test(expected=IllegalArgumentException.class) + public void testLoadLibraryIllegalPrefix() throws IOException { + NativeUtils.loadLibraryFromJar("/l"); + } + + @Test(expected= FileNotFoundException.class) + public void testLoadLibraryNonExistentPath() throws IOException { + NativeUtils.loadLibraryFromJar("/libtest.so"); + } + + @Test(expected=NullPointerException.class) + public void testLoadLibraryNullPath() throws IOException { + NativeUtils.loadLibraryFromJar(null); + } +}