@Test public void testFitsDeleteHdu() throws Exception { try (Fits fits1 = makeAsciiTable()) { fits1.read(); Exception actual = null; try { fits1.deleteHDU(-2); } catch (FitsException ex) { actual = ex; } Assert.assertNotNull(actual); Assert.assertNull(fits1.getHDU(99)); // will be ignored fits1.insertHDU(null, 99); fits1.deleteHDU(2); fits1.deleteHDU(2); writeFile(fits1, TARGET_BASIC_FITS_TEST_FITS); } Fits fits1 = new Fits(new File(TARGET_BASIC_FITS_TEST_FITS)); fits1.readHDU(); AsciiTableHDU hdu2 = (AsciiTableHDU) fits1.readHDU(); AsciiTableHDU hdu3 = (AsciiTableHDU) fits1.readHDU(); Assert.assertArrayEquals(new int[] {11}, (int[]) hdu2.getData().getElement(1, 1)); Assert.assertArrayEquals(new int[] {41}, (int[]) hdu3.getData().getElement(1, 1)); hdu3.getData(); }
@Test public void testFitsSkipHdu() throws Exception { Fits fits1 = makeAsciiTable(); BasicHDU<?> image = fits1.readHDU(); AsciiTableHDU hdu2 = (AsciiTableHDU) fits1.readHDU(); fits1.skipHDU(2); AsciiTableHDU hdu3 = (AsciiTableHDU) fits1.readHDU(); hdu2.info(System.out); hdu3.info(System.out); Assert.assertArrayEquals(new int[] {11}, (int[]) hdu2.getData().getElement(1, 1)); Assert.assertArrayEquals(new int[] {41}, (int[]) hdu3.getData().getElement(1, 1)); hdu3.getData(); }