File: TestH5Eregister.java

package info (click to toggle)
jhdf 2.11.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 39,996 kB
  • ctags: 17,959
  • sloc: java: 100,416; ansic: 24,920; sh: 2,256; makefile: 957; cpp: 48
file content (54 lines) | stat: -rw-r--r-- 1,554 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package test.hdf5lib;

import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import ncsa.hdf.hdf5lib.H5;

import org.junit.Before;
import org.junit.Test;

public class TestH5Eregister {

    @Before
    public void checkOpenIDs() {
        assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
    }

    @Test(expected = NullPointerException.class)
    public void testH5Eregister_class_cls_name_null() throws Throwable {
        H5.H5Eregister_class(null, "libname", "version");
    }

    @Test(expected = NullPointerException.class)
    public void testH5Eregister_class_lib_name_null() throws Throwable {
        H5.H5Eregister_class("clsname", null, "version");
    }

    @Test(expected = NullPointerException.class)
    public void testH5Eregister_class_version_null() throws Throwable {
        H5.H5Eregister_class("clsname", "libname", null);
    }

    @Test(expected = IllegalArgumentException.class)
    public void testH5Eunregister_class_invalid_classid() throws Throwable {
        H5.H5Eunregister_class(-1);
    }

    @Test
    public void testH5Eregister_class() {
        int hdf_java_classid = -1;
        try {
            hdf_java_classid = H5.H5Eregister_class("HDF-Java-Error",
                    "hdf-java", "2.5");
        }
        catch (Throwable err) {
            fail("H5.H5Eregister_class: " + err);
        }
        try {
            H5.H5Eunregister_class(hdf_java_classid);
        }
        catch (Throwable err) {
            fail("H5.H5Eunregister_class: " + err);
        }
    }
}