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: * @author Elena V. Sayapina
19: * @version $Revision: 1.3 $
20: */package javax.print.attribute.standard;
21:
22: import javax.print.attribute.EnumSyntax;
23:
24: import junit.framework.TestCase;
25:
26: public class MediaSizeNameTest extends TestCase {
27:
28: public static void main(String[] args) {
29: junit.textui.TestRunner.run(MediaSizeNameTest.class);
30: }
31:
32: static {
33: System.out.println("MediaSizeName testing...");
34: }
35:
36: /*
37: * MediaSizeName constructor testing.
38: */
39: public final void testMediaName() {
40: MediaSizeName msn = new mediaSizeName(0);
41: assertEquals(0, msn.getValue());
42: assertEquals("iso-a0", msn.toString());
43:
44: msn = mediaSizeName.A;
45: assertEquals("a", msn.toString());
46:
47: msn = mediaSizeName.FOLIO;
48: assertEquals("folio", msn.toString());
49: }
50:
51: /*
52: * getStringTable(), getEnumValueTable() method testing.
53: */
54: public void testGetStringTable() {
55: mediaSizeName msn = new mediaSizeName(1);
56: String[] str = msn.getStringTableEx();
57: EnumSyntax[] table = msn.getEnumValueTableEx();
58: assertEquals(str.length, table.length);
59: assertEquals(73, str.length);
60:
61: //Tests that StringTable isn't changed for MediaSizeName class
62: msn = new mediaSizeName(1);
63: str = msn.getStringTableEx();
64: str[1] = "MediaSizeName1";
65: //System.out.println(msn.getStringTable()[1]);
66: assertFalse(msn.getStringTableEx()[1].equals("MediaSizeName1"));
67: }
68:
69: /*
70: * Auxiliary class
71: */
72: public class mediaSizeName extends MediaSizeName {
73:
74: public mediaSizeName(int value) {
75: super (value);
76: }
77:
78: public String[] getStringTableEx() {
79: return getStringTable();
80: }
81:
82: public EnumSyntax[] getEnumValueTableEx() {
83: return getEnumValueTable();
84: }
85: }
86:
87: }
|