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