1 /**
2 * MicroEmulator
3 * Copyright (C) 2006-2008 Bartek Teodorczyk <barteo@barteo.net>
4 * Copyright (C) 2006-2008 Vlad Skarzhevskyy
5 *
6 * It is licensed under the following two licenses as alternatives:
7 * 1. GNU Lesser General Public License (the "LGPL") version 2.1 or any newer version
8 * 2. Apache License (the "AL") Version 2.0
9 *
10 * You may not use this file except in compliance with at least one of
11 * the above two licenses.
12 *
13 * You may obtain a copy of the LGPL at
14 * http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
15 *
16 * You may obtain a copy of the AL at
17 * http://www.apache.org/licenses/LICENSE-2.0
18 *
19 * Unless required by applicable law or agreed to in writing, software
20 * distributed under the License is distributed on an "AS IS" BASIS,
21 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 * See the LGPL or the AL for the specific language governing permissions and
23 * limitations.
24 *
25 * @version $Id: MIDletResourceInputStreamTest.java 1733 2008-05-30 06:53:29Z vlads $
26 */
27 package org.microemu.app.util;
28
29 import java.io.ByteArrayInputStream;
30 import java.io.IOException;
31
32 import junit.framework.TestCase;
33
34 /**
35 * @author vlads
36 *
37 */
38 public class MIDletResourceInputStreamTest extends TestCase {
39
40 private void setData(byte data[]) {
41 for (int i = 0; i < data.length; i++) {
42 data[i] = (byte) i;
43 }
44 }
45
46 public void testReadPart() throws IOException {
47 int max = 10;
48 byte data[] = new byte[max];
49 setData(data);
50 ByteArrayInputStream is = new ByteArrayInputStream(data);
51 MIDletResourceInputStream mis = new MIDletResourceInputStream(is);
52 byte data2[] = new byte[max + 5];
53 int rc = mis.read(data2);
54 assertEquals("read part", max, rc);
55 }
56
57 }