1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.compress.harmony.unpack200;
18
19 import static org.junit.jupiter.api.Assertions.assertEquals;
20
21 import java.io.ByteArrayInputStream;
22 import java.io.IOException;
23 import java.io.InputStream;
24
25 import org.apache.commons.compress.harmony.pack200.BHSDCodec;
26 import org.apache.commons.compress.harmony.pack200.Codec;
27 import org.apache.commons.compress.harmony.pack200.Pack200Exception;
28 import org.junit.jupiter.api.Disabled;
29 import org.junit.jupiter.api.Test;
30
31 public class BandSetTest {
32
33 public class MockSegment extends Segment {
34
35 @Override
36 public SegmentHeader getSegmentHeader() {
37 return new SegmentHeader(this);
38 }
39 }
40
41 private final BandSet bandSet = new BandSet(new MockSegment()) {
42
43 @Override
44 public void read(final InputStream inputStream) throws IOException, Pack200Exception {
45 }
46
47 @Override
48 public void unpack() throws IOException, Pack200Exception {
49 }
50
51 };
52
53 @Test
54 public void testDecodeBandInt() throws IOException, Pack200Exception {
55 final BHSDCodec codec = Codec.BYTE1;
56 final byte[] bytes = { (byte) 3, (byte) 56, (byte) 122, (byte) 78 };
57 final InputStream in = new ByteArrayInputStream(bytes);
58 final int[] ints = bandSet.decodeBandInt("Test Band", in, codec, 4);
59 for (int i = 0; i < ints.length; i++) {
60 assertEquals(ints[i], bytes[i], "Wrong value in position " + i);
61 }
62 }
63
64 @Test
65 @Disabled("TODO: Implement")
66 public void testParseFlags1() {
67
68 }
69
70 @Test
71 @Disabled("TODO: Implement")
72 public void testParseFlags2() {
73
74 }
75
76 @Test
77 @Disabled("TODO: Implement")
78 public void testParseFlags3() {
79
80 }
81
82 @Test
83 @Disabled("TODO: Implement")
84 public void testParseReferences1() {
85
86 }
87
88 @Test
89 @Disabled("TODO: Implement")
90 public void testParseReferences2() {
91
92 }
93
94 }