diff options
author | Jordan Henderson <jhenderson@hdfgroup.org> | 2019-02-11 16:58:58 (GMT) |
---|---|---|
committer | Jordan Henderson <jhenderson@hdfgroup.org> | 2019-02-14 17:53:36 (GMT) |
commit | 35f48aac5b2e10d6c3e2b3176bbde6aad209c758 (patch) | |
tree | 071fde9e228c1bb4574bf1606b134677631b793e /java/test | |
parent | 0527ced1c7eb3f7ae8f43c0c705a1cb73539bd35 (diff) | |
download | hdf5-35f48aac5b2e10d6c3e2b3176bbde6aad209c758.zip hdf5-35f48aac5b2e10d6c3e2b3176bbde6aad209c758.tar.gz hdf5-35f48aac5b2e10d6c3e2b3176bbde6aad209c758.tar.bz2 |
Re-write of Java JNI error handling
Diffstat (limited to 'java/test')
-rw-r--r-- | java/test/TestH5.java | 17 | ||||
-rw-r--r-- | java/test/TestH5Edefault.java | 2 | ||||
-rw-r--r-- | java/test/TestH5Oparams.java | 4 | ||||
-rw-r--r-- | java/test/TestH5Sbasic.java | 2 | ||||
-rw-r--r-- | java/test/testfiles/JUnit-TestH5.txt | 3 |
5 files changed, 23 insertions, 5 deletions
diff --git a/java/test/TestH5.java b/java/test/TestH5.java index 133f765..6122c14 100644 --- a/java/test/TestH5.java +++ b/java/test/TestH5.java @@ -177,6 +177,23 @@ public class TestH5 { for (int i = 0; i < 2; i++) assertFalse(libversion[i] == 0); } + + /** + * Test method for {@link hdf.hdf5lib.H5#H5get_libversion(int[])} + * to ensure a null libversion parameter causes the function to + * fail. + */ + @Test + public void testH5get_libversion_null_param() { + try { + H5.H5get_libversion(null); + } + catch (Throwable err) { + return; + } + + fail("H5.H5get_libversion: succeeded with a null libversion parameter!"); + } /** * Test method for diff --git a/java/test/TestH5Edefault.java b/java/test/TestH5Edefault.java index b510936..076d313 100644 --- a/java/test/TestH5Edefault.java +++ b/java/test/TestH5Edefault.java @@ -239,7 +239,7 @@ public class TestH5Edefault { H5.H5Eget_class_name(-1); } - @Test(expected = IllegalArgumentException.class) + @Test(expected = HDF5LibraryException.class) public void testH5Eget_class_name_invalid_classname() throws Throwable { H5.H5Eget_class_name(HDF5Constants.H5E_DEFAULT); } diff --git a/java/test/TestH5Oparams.java b/java/test/TestH5Oparams.java index 8b3c673..d340ee7 100644 --- a/java/test/TestH5Oparams.java +++ b/java/test/TestH5Oparams.java @@ -124,7 +124,7 @@ public class TestH5Oparams { H5.H5Oset_comment(-1, "Bogus"); } - @Test(expected = IllegalArgumentException.class) + @Test(expected = HDF5LibraryException.class) public void testH5Oget_comment_invalid() throws Throwable { H5.H5Oget_comment(-1); } @@ -139,7 +139,7 @@ public class TestH5Oparams { H5.H5Oset_comment_by_name(-1, null, null, -1); } - @Test(expected = IllegalArgumentException.class) + @Test(expected = HDF5LibraryException.class) public void testH5Oget_comment_by_name_invalid() throws Throwable { H5.H5Oget_comment_by_name(-1, "Bogus", -1); } diff --git a/java/test/TestH5Sbasic.java b/java/test/TestH5Sbasic.java index 3007495..2173647 100644 --- a/java/test/TestH5Sbasic.java +++ b/java/test/TestH5Sbasic.java @@ -49,7 +49,7 @@ public class TestH5Sbasic { H5.H5Screate(-1); } - @Test(expected = HDF5LibraryException.class) + @Test(expected = IllegalArgumentException.class) public void testH5Sget_simple_extent_type_invalid() throws Throwable { H5.H5Sget_simple_extent_type(-1); } diff --git a/java/test/testfiles/JUnit-TestH5.txt b/java/test/testfiles/JUnit-TestH5.txt index 37c5b65..b282a91 100644 --- a/java/test/testfiles/JUnit-TestH5.txt +++ b/java/test/testfiles/JUnit-TestH5.txt @@ -1,4 +1,5 @@ JUnit version 4.11 +.testH5get_libversion_null_param .testJ2C .testIsSerializable .testH5garbage_collect @@ -11,5 +12,5 @@ JUnit version 4.11 Time: XXXX -OK (9 tests) +OK (10 tests) |