Add basic unit tests

This commit is contained in:
andreblanke
2017-10-24 22:13:38 +02:00
parent 922917e2be
commit 9311279ed3
2 changed files with 37 additions and 0 deletions

View File

@@ -31,5 +31,13 @@
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@@ -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);
}
}