3821N/A/*
3821N/A@test
3821N/A@bug 7023011
3821N/A@library ../../../regtesthelpers
3821N/A@build Sysout
3821N/A@summary Toolkit.getPrintJob() throws wrong exceptions
3821N/A@author andrei dmitriev: area=awt.headless
3821N/A@run main GetPrintJob
3821N/A */
3821N/A
3821N/Aimport java.awt.*;
3821N/Aimport java.util.Properties;
3821N/Aimport test.java.awt.regtesthelpers.Sysout;
3821N/A/*
3821N/A * In headfull mode we should always getting NPE on the getPrintJob() call if frame == null.
3821N/A */
3821N/A
3821N/Apublic class GetPrintJob {
3821N/A
3821N/A public static void main(String[] s) {
3821N/A boolean stage1Passed = false;
3821N/A boolean stage2Passed = false;
3821N/A
3821N/A try {
3821N/A Toolkit.getDefaultToolkit().getPrintJob(
3821N/A (Frame) null, "title", new Properties());
3821N/A } catch (NullPointerException e) {
3821N/A stage1Passed = true;
3821N/A Sysout.println("Stage 1 passed. getPrintJob(null, String, property) has thrown NPE.");
3821N/A }
3821N/A if (!stage1Passed) {
3821N/A throw new RuntimeException("getPrintJob() should have thrown NPE but didn't.");
3821N/A }
3821N/A
3821N/A try {
3821N/A Toolkit.getDefaultToolkit().getPrintJob(
3821N/A (Frame) null, "title", new JobAttributes(), new PageAttributes());
3821N/A } catch (NullPointerException e) {
3821N/A stage2Passed = true;
3821N/A Sysout.println("Stage 2 passed. getPrintJob(null, String, jobAttrs, pageAttr) has thrown NPE.");
3821N/A }
3821N/A if (!stage2Passed) {
3821N/A throw new RuntimeException("getPrintJob() should have thrown NPE but didn't.");
3821N/A }
3821N/A
3821N/A Sysout.println("Test PASSED");
3821N/A }
3821N/A}