mirror of
https://github.com/jlengrand/native-utils.git
synced 2026-03-10 08:31:22 +00:00
Add basic unit tests
This commit is contained in:
8
pom.xml
8
pom.xml
@@ -31,5 +31,13 @@
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
29
src/test/java/cz/adamh/utils/NativeUtilsTest.java
Normal file
29
src/test/java/cz/adamh/utils/NativeUtilsTest.java
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user