001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: /**
018: * @author Elena V. Sayapina
019: * @version $Revision: 1.3 $
020: */package javax.print.attribute.standard;
021:
022: import javax.print.attribute.EnumSyntax;
023:
024: import junit.framework.TestCase;
025:
026: public class JobStateReasonTest extends TestCase {
027:
028: public static void main(String[] args) {
029: junit.textui.TestRunner.run(JobStateReasonTest.class);
030: }
031:
032: static {
033: System.out.println("JobStateReason testing...");
034: }
035:
036: jobStateReason reason;
037:
038: /*
039: * JobStateReason constructor testing.
040: */
041: public final void testFinishings() {
042:
043: reason = new jobStateReason(20);
044: assertEquals(20, reason.getValue());
045:
046: reason = new jobStateReason(40);
047: assertEquals(40, reason.getValue());
048: assertEquals("40", reason.toString());
049: }
050:
051: /*
052: * getEnumValueTable(), getStringTable() methods testing.
053: */
054: public final void testGetStringTable() {
055:
056: int quantity = 0;
057: reason = new jobStateReason(5);
058: String[] str = reason.getStringTableEx();
059: EnumSyntax[] table = reason.getEnumValueTableEx();
060: assertEquals(str.length, table.length);
061: assertTrue(29 == table.length);
062:
063: //Tests that StringTable isn't changed for JobStateReason
064: reason = new jobStateReason(1);
065: str = reason.getStringTableEx();
066: str[1] = "reason1";
067: //System.out.println(reason.getStringTable()[1]);
068: assertFalse(reason.getStringTableEx()[1].equals("reason1"));
069: }
070:
071: /*
072: * getCategory() method testing.
073: */
074: public final void testGetCategory() {
075: JobStateReason jsreason = JobStateReason.ABORTED_BY_SYSTEM;
076: assertEquals(JobStateReason.class, jsreason.getCategory());
077: }
078:
079: /*
080: * getName() method testing.
081: */
082: public final void testGetName() {
083: JobStateReason jsreason = JobStateReason.UNSUPPORTED_DOCUMENT_FORMAT;
084: assertEquals("job-state-reason", jsreason.getName());
085: }
086:
087: /*
088: * Auxiliary class
089: */
090: public class jobStateReason extends JobStateReason {
091:
092: public jobStateReason(int value) {
093: super (value);
094: }
095:
096: public String[] getStringTableEx() {
097: return getStringTable();
098: }
099:
100: public EnumSyntax[] getEnumValueTableEx() {
101: return getEnumValueTable();
102: }
103: }
104:
105: }
|