1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 * Copyright by The HDF Group. * 3 * All rights reserved. * 4 * * 5 * This file is part of HDF Products. The full HDF copyright * 6 * notice, including terms governing use, modification, and redistribution, * 7 * is contained in the file, COPYING. COPYING can be found at the root of * 8 * the source code distribution tree. You can also access it online at * 9 * http://www.hdfgroup.org/products/licenses.html. If you do not have * 10 * access to the file, you may request a copy from help@hdfgroup.org. * 11 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 12 13 package test; 14 15 import static org.junit.Assert.assertEquals; 16 import static org.junit.Assert.assertFalse; 17 import static org.junit.Assert.assertTrue; 18 import static org.junit.Assert.fail; 19 20 import java.io.File; 21 22 import hdf.hdflib.HDFLibrary; 23 import hdf.hdflib.HDFException; 24 import hdf.hdflib.HDFChunkInfo; 25 import hdf.hdflib.HDFConstants; 26 27 import org.junit.After; 28 import org.junit.Before; 29 import org.junit.Ignore; 30 import org.junit.Rule; 31 import org.junit.Test; 32 import org.junit.rules.TestName; 33 34 35 public class TestH4DFRparams { 36 @Rule public TestName testname = new TestName(); 37 38 @Before showTestName()39 public void showTestName() { 40 System.out.print(testname.getMethodName()); 41 } 42 43 @After nextTestName()44 public void nextTestName() { 45 System.out.println(); 46 } 47 48 @Test(expected = NullPointerException.class) testDFR8getdimsNullFilename()49 public void testDFR8getdimsNullFilename() throws Throwable { 50 HDFLibrary.DFR8getdims(null, new int[] {0, 0}, new boolean[] { true }); 51 } 52 53 @Test(expected = NullPointerException.class) testDFR8getdimsNullDimensions()54 public void testDFR8getdimsNullDimensions() throws Throwable { 55 String str = ""; 56 HDFLibrary.DFR8getdims(str, null, new boolean[] { true }); 57 } 58 59 @Test(expected = NullPointerException.class) testDFR8getdimsNullPalette()60 public void testDFR8getdimsNullPalette() throws Throwable { 61 String str = ""; 62 HDFLibrary.DFR8getdims(str, new int[] {0, 0}, null); 63 } 64 65 @Test(expected = IllegalArgumentException.class) testDFR8getdimsIllegalArgument()66 public void testDFR8getdimsIllegalArgument() throws Throwable { 67 String str = ""; 68 HDFLibrary.DFR8getdims(str, new int[] {0}, new boolean[] { true }); 69 } 70 71 @Test(expected = NullPointerException.class) testDFR8getimageNullFilename()72 public void testDFR8getimageNullFilename() throws Throwable { 73 HDFLibrary.DFR8getimage(null, new byte[] { (byte) 0x0 }, 0, 0, new byte[] { (byte) 0x0 }); 74 } 75 76 @Test(expected = NullPointerException.class) testDFR8getimageNullImageData()77 public void testDFR8getimageNullImageData() throws Throwable { 78 String str = ""; 79 HDFLibrary.DFR8getimage(str, null, 0, 0, new byte[] { (byte) 0x0 }); 80 } 81 82 @Test(expected = NullPointerException.class) testDFR8readrefNullFilename()83 public void testDFR8readrefNullFilename() throws Throwable { 84 HDFLibrary.DFR8readref(null, 0); 85 } 86 87 @Test(expected = HDFException.class) testDFR8readrefIllegalRef()88 public void testDFR8readrefIllegalRef() throws Throwable { 89 String str = ""; 90 HDFLibrary.DFR8readref(str, -1); 91 } 92 93 @Test(expected = NullPointerException.class) testDFR8nimagesNullFilename()94 public void testDFR8nimagesNullFilename() throws Throwable { 95 HDFLibrary.DFR8nimages(null); 96 } 97 98 @Test(expected = NullPointerException.class) testDFR8addimageNullFilename()99 public void testDFR8addimageNullFilename() throws Throwable { 100 HDFLibrary.DFR8addimage(null, new byte[] { (byte) 0x0 }, 0, 0, (short) 0); 101 } 102 103 @Test(expected = NullPointerException.class) testDFR8addimageNullImage()104 public void testDFR8addimageNullImage() throws Throwable { 105 String str = ""; 106 HDFLibrary.DFR8addimage(str, null, 0, 0, (short) 0); 107 } 108 109 @Test(expected = NullPointerException.class) testDFR8putimageNullFilename()110 public void testDFR8putimageNullFilename() throws Throwable { 111 HDFLibrary.DFR8putimage(null, new byte[] { (byte) 0x0 }, 0, 0, (short) 0); 112 } 113 114 @Test(expected = NullPointerException.class) testDFR8putimageNullImage()115 public void testDFR8putimageNullImage() throws Throwable { 116 String str = ""; 117 HDFLibrary.DFR8putimage(str, null, 0, 0, (short) 0); 118 } 119 120 @Test(expected = NullPointerException.class) testDFR8setcompressNullCompInfo()121 public void testDFR8setcompressNullCompInfo() throws Throwable { 122 HDFLibrary.DFR8setcompress(0, null); 123 } 124 125 @Test(expected = NullPointerException.class) testDFR8getpalrefNullPalRef()126 public void testDFR8getpalrefNullPalRef() throws Throwable { 127 HDFLibrary.DFR8getpalref(null); 128 } 129 130 @Test(expected = IllegalArgumentException.class) testDFR8getpalrefIllegalArgument()131 public void testDFR8getpalrefIllegalArgument() throws Throwable { 132 HDFLibrary.DFR8getpalref(new short[] { }); 133 } 134 135 @Test(expected = NullPointerException.class) testDFR8writerefNullFilename()136 public void testDFR8writerefNullFilename() throws Throwable { 137 HDFLibrary.DFR8writeref(null, (short) 0); 138 } 139 } 140