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 public class TestH4DFparams { 35 @Rule public TestName testname = new TestName(); 36 37 @Before showTestName()38 public void showTestName() { 39 System.out.print(testname.getMethodName()); 40 } 41 42 @After nextTestName()43 public void nextTestName() { 44 System.out.println(); 45 } 46 47 @Test(expected = NullPointerException.class) testDF24getdimsNullFilename()48 public void testDF24getdimsNullFilename() throws Throwable { 49 HDFLibrary.DF24getdims(null, new int[] { 0, 0, 0 }); 50 } 51 52 @Test(expected = NullPointerException.class) testDF24getdimsNullArguments()53 public void testDF24getdimsNullArguments() throws Throwable { 54 String str = ""; 55 HDFLibrary.DF24getdims(str, null); 56 } 57 58 @Test(expected = IllegalArgumentException.class) testDF24getdimsIllegalArgument()59 public void testDF24getdimsIllegalArgument() throws Throwable { 60 String str = ""; 61 HDFLibrary.DF24getdims(str, new int[] { 0, 0 }); 62 } 63 64 @Test(expected = NullPointerException.class) testDF24getimageNullFilename()65 public void testDF24getimageNullFilename() throws Throwable { 66 HDFLibrary.DF24getimage(null, new byte[] { (byte) 0x0 }, 0, 0); 67 } 68 69 @Test(expected = NullPointerException.class) testDF24getimageNullImageData()70 public void testDF24getimageNullImageData() throws Throwable { 71 String str = ""; 72 HDFLibrary.DF24getimage(str, null, 0, 0); 73 } 74 75 @Test(expected = NullPointerException.class) testDF24readrefNullFilename()76 public void testDF24readrefNullFilename() throws Throwable { 77 HDFLibrary.DF24readref(null, 0); 78 } 79 80 @Test(expected = HDFException.class) testDF24readrefIllegalRef()81 public void testDF24readrefIllegalRef() throws Throwable { 82 String str = ""; 83 HDFLibrary.DF24readref(str, -1); 84 } 85 86 @Test(expected = NullPointerException.class) testDF24nimagesNullFilename()87 public void testDF24nimagesNullFilename() throws Throwable { 88 HDFLibrary.DF24nimages(null); 89 } 90 91 @Test(expected = NullPointerException.class) testDF24addimageNullFilename()92 public void testDF24addimageNullFilename() throws Throwable { 93 HDFLibrary.DF24addimage(null, new byte[] { (byte) 0x0 }, 0, 0); 94 } 95 96 @Test(expected = NullPointerException.class) testDF24addimageNullImage()97 public void testDF24addimageNullImage() throws Throwable { 98 String str = ""; 99 HDFLibrary.DF24addimage(str, null, 0, 0); 100 } 101 102 @Test(expected = NullPointerException.class) testDF24putimageNullFilename()103 public void testDF24putimageNullFilename() throws Throwable { 104 byte[] img = {0}; 105 HDFLibrary.DF24putimage(null, img, 0, 0); 106 } 107 108 @Test(expected = NullPointerException.class) testDF24putimageNullImage()109 public void testDF24putimageNullImage() throws Throwable { 110 String str = ""; 111 byte[] img = null; 112 HDFLibrary.DF24putimage(str, img, 0, 0); 113 } 114 115 @Test(expected = IllegalArgumentException.class) testDF24putimageIllegalArgument()116 public void testDF24putimageIllegalArgument() throws Throwable { 117 String str = ""; 118 HDFLibrary.DF24putimage(str, new byte[] { }, 0, 0); 119 } 120 121 @Test(expected = NullPointerException.class) testDF24setcompressNullCompInfo()122 public void testDF24setcompressNullCompInfo() throws Throwable { 123 HDFLibrary.DF24setcompress(0, null); 124 } 125 126 @Test(expected = HDFException.class) testDF24setilIllegalIl()127 public void testDF24setilIllegalIl() throws Throwable { 128 HDFLibrary.DF24setil(-1); 129 } 130 } 131