1 package nom.tam.fits;
2
3 /*-
4 * #%L
5 * nom.tam FITS library
6 * %%
7 * Copyright (C) 1996 - 2024 nom-tam-fits
8 * %%
9 * This is free and unencumbered software released into the public domain.
10 *
11 * Anyone is free to copy, modify, publish, use, compile, sell, or
12 * distribute this software, either in source code form or as a compiled
13 * binary, for any purpose, commercial or non-commercial, and by any
14 * means.
15 *
16 * In jurisdictions that recognize copyright laws, the author or authors
17 * of this software dedicate any and all copyright interest in the
18 * software to the public domain. We make this dedication for the benefit
19 * of the public at large and to the detriment of our heirs and
20 * successors. We intend this dedication to be an overt act of
21 * relinquishment in perpetuity of all present and future rights to this
22 * software under copyright law.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
27 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
28 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
29 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
30 * OTHER DEALINGS IN THE SOFTWARE.
31 * #L%
32 */
33 import static org.junit.Assert.assertFalse;
34
35 import org.junit.Test;
36
37 import nom.tam.util.ArrayDataInput;
38 import nom.tam.util.ArrayDataOutput;
39
40 public class DeferredTest {
41
42 @Test
43 public void isDeferredAsciiTableNew() throws Exception {
44 assertFalse(new AsciiTable().isDeferred());
45 }
46
47 @Test
48 public void isDeferredBinaryTableNew() throws Exception {
49 assertFalse(new BinaryTable().isDeferred());
50 }
51
52 @Test
53 public void isDeferredImageDataNew() throws Exception {
54 assertFalse(new ImageData().isDeferred());
55 }
56
57 @Test
58 public void isDeferredRandomGroupsDataNew() throws Exception {
59 assertFalse(new RandomGroupsData().isDeferred());
60 }
61
62 @Test
63 public void isDeferredUndefinedDataNew() throws Exception {
64 assertFalse(new UndefinedData(new int[10]).isDeferred());
65 }
66
67 @Test
68 public void isDeferredDataNew() throws Exception {
69 assertFalse(new DefaultData().isDeferred());
70 }
71
72 @Test
73 public void deferredDataRewrite() throws Exception {
74 new DefaultData() {
75 @Override
76 public boolean isDeferred() {
77 return true;
78 }
79 }.rewrite(); // No exception is good enough!
80 }
81
82 class DefaultData extends Data {
83 @Override
84 protected void fillHeader(Header head) throws FitsException {
85 }
86
87 @Override
88 public Object getData() throws FitsException {
89 return null;
90 }
91
92 @Override
93 protected long getTrueSize() {
94 return 0;
95 }
96
97 @Override
98 public void read(ArrayDataInput in) throws FitsException {
99 throw new FitsException("not implemented");
100 }
101
102 @Override
103 public void write(ArrayDataOutput o) throws FitsException {
104 throw new FitsException("not implemented");
105 }
106
107 @Override
108 protected Object getCurrentData() {
109 // TODO Auto-generated method stub
110 return null;
111 }
112
113 @Override
114 protected void loadData(ArrayDataInput in) {
115 // TODO Auto-generated method stub
116 }
117
118 @Override
119 public BasicHDU<?> toHDU() {
120 // TODO Auto-generated method stub
121 return null;
122 }
123 }
124 }