01: /* ====================================================================
02: Licensed to the Apache Software Foundation (ASF) under one or more
03: contributor license agreements. See the NOTICE file distributed with
04: this work for additional information regarding copyright ownership.
05: The ASF licenses this file to You under the Apache License, Version 2.0
06: (the "License"); you may not use this file except in compliance with
07: the License. You may obtain a copy of the License at
08:
09: 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:
18: package org.apache.poi.hsmf.model;
19:
20: import org.apache.poi.hsmf.datatypes.Chunk;
21: import org.apache.poi.hsmf.datatypes.Chunks;
22: import org.apache.poi.hsmf.datatypes.StringChunk;
23:
24: import junit.framework.TestCase;
25:
26: /**
27: * Verifies that the Chunks class is actually setup properly and hasn't been changed in ways
28: * that will break the library.
29: *
30: * @author Travis Ferguson
31: *
32: */
33: public class TestChunkData extends TestCase {
34: public void testChunkCreate() {
35: StringChunk chunk = new StringChunk(0x0200);
36: TestCase.assertEquals("__substg1.0_0200001E", chunk
37: .getEntryName());
38:
39: /* test the lower and upper limits of the chunk ids */
40: chunk = new StringChunk(0x0000);
41: TestCase.assertEquals("__substg1.0_0000001E", chunk
42: .getEntryName());
43:
44: chunk = new StringChunk(0xFFFF);
45: TestCase.assertEquals("__substg1.0_FFFF001E", chunk
46: .getEntryName());
47: }
48:
49: public void testTextBodyChunk() {
50: StringChunk chunk = new StringChunk(0x1000);
51: TestCase.assertEquals(chunk.getEntryName(), Chunks
52: .getInstance().textBodyChunk.getEntryName());
53: }
54:
55: public void testDisplayToChunk() {
56: StringChunk chunk = new StringChunk(0x0E04);
57: TestCase.assertEquals(chunk.getEntryName(), Chunks
58: .getInstance().displayToChunk.getEntryName());
59: }
60:
61: public void testDisplayCCChunk() {
62: StringChunk chunk = new StringChunk(0x0E03);
63: TestCase.assertEquals(chunk.getEntryName(), Chunks
64: .getInstance().displayCCChunk.getEntryName());
65: }
66:
67: public void testDisplayBCCChunk() {
68: StringChunk chunk = new StringChunk(0x0E02);
69: TestCase.assertEquals(chunk.getEntryName(), Chunks
70: .getInstance().displayBCCChunk.getEntryName());
71: }
72:
73: public void testSubjectChunk() {
74: Chunk chunk = new StringChunk(0x0037);
75: TestCase.assertEquals(chunk.getEntryName(), Chunks
76: .getInstance().subjectChunk.getEntryName());
77: }
78:
79: }
|