View Javadoc
1   /*
2    *  Licensed to the Apache Software Foundation (ASF) under one or more
3    *  contributor license agreements.  See the NOTICE file distributed with
4    *  this work for additional information regarding copyright ownership.
5    *  The ASF licenses this file to You under the Apache License, Version 2.0
6    *  (the "License"); you may not use this file except in compliance with
7    *  the License.  You may obtain a copy of the License at
8    *
9    *     http://www.apache.org/licenses/LICENSE-2.0
10   *
11   *  Unless required by applicable law or agreed to in writing, software
12   *  distributed under the License is distributed on an "AS IS" BASIS,
13   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   *  See the License for the specific language governing permissions and
15   *  limitations under the License.
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  }