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 Igor A. Pyankov
19: * @version $Revision: 1.2 $
20: */package javax.print;
21:
22: import javax.print.attribute.standard.JobStateReason;
23:
24: import junit.framework.TestCase;
25:
26: public class IsAttributeCategorySupportedTest extends TestCase {
27:
28: public void testIsAttributeCategorySupported() {
29: System.out
30: .println("============= START testIsAttributeCategorySupported ================");
31:
32: PrintService[] services;
33: Class[] claz;
34: boolean supported;
35:
36: services = PrintServiceLookup.lookupPrintServices(null, null);
37: TestUtil.checkServices(services);
38: for (int i = 0, ii = services.length; i < ii; i++) {
39: System.out.println("------------------"
40: + services[i].getName() + "-------------------");
41: claz = services[i].getSupportedAttributeCategories();
42: for (int j = 0, jj = claz.length; j < jj; j++) {
43: supported = services[i]
44: .isAttributeCategorySupported(claz[j]);
45: if (!supported) {
46: fail("Category " + claz[j] + " must be supported.");
47: }
48: System.out.println(claz[j] + ": " + supported);
49: }
50:
51: supported = services[i]
52: .isAttributeCategorySupported(JobStateReason.ABORTED_BY_SYSTEM
53: .getCategory());
54: if (supported) {
55: fail("Category "
56: + JobStateReason.ABORTED_BY_SYSTEM
57: .getCategory()
58: + " must not be supported.");
59: }
60: System.out.println(JobStateReason.ABORTED_BY_SYSTEM
61: .getCategory()
62: + ": " + supported);
63: }
64:
65: System.out
66: .println("============= END testIsAttributeCategorySupported ================");
67: }
68:
69: }
|