11/*
2- * Copyright (c) 2005, 2024 , Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 2005, 2025 , Oracle and/or its affiliates. All rights reserved.
33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44 *
55 * This code is free software; you can redistribute it and/or modify it
2121 * questions.
2222 */
2323
24+ import java .awt .Desktop ;
25+ import java .io .IOException ;
26+ import java .lang .reflect .InvocationTargetException ;
27+ import java .net .URI ;
28+ import javax .swing .JPanel ;
29+
30+ import jtreg .SkippedException ;
31+
2432/*
2533 * @test
2634 * @bug 6255196
2735 * @summary Verifies the function of methods mail() and mail(java.net.URI uri).
28- * @library /java/awt/regtesthelpers
29- * @build PassFailJFrame
36+ * @library /java/awt/regtesthelpers /test/lib
37+ * @build PassFailJFrame jtreg.SkippedException
3038 * @run main/manual MailTest
3139 */
3240
33- import java .awt .Desktop ;
34- import java .io .IOException ;
35- import java .lang .reflect .InvocationTargetException ;
36- import java .net .URI ;
37- import javax .swing .JPanel ;
38-
3941public class MailTest extends JPanel {
4042
4143 static final String INSTRUCTIONS = """
@@ -48,18 +50,7 @@ public class MailTest extends JPanel {
4850 """ ;
4951
5052 private MailTest () {
51- if (!Desktop .isDesktopSupported ()) {
52- PassFailJFrame .log ("Class java.awt.Desktop is not supported on " +
53- "current platform. Farther testing will not be performed" );
54- PassFailJFrame .forcePass ();
55- }
56-
5753 Desktop desktop = Desktop .getDesktop ();
58- if (!desktop .isSupported (Desktop .Action .MAIL )) {
59- PassFailJFrame .log ("Action.MAIL is not supported." );
60- PassFailJFrame .forcePass ();
61- }
62-
6354 /*
6455 * Part 1: launch the mail composing window without a mailto URI.
6556 */
@@ -103,6 +94,15 @@ private MailTest() {
10394
10495 public static void main (String [] args ) throws InterruptedException ,
10596 InvocationTargetException {
97+ if (!Desktop .isDesktopSupported ()) {
98+ throw new SkippedException ("Class java.awt.Desktop is not supported " +
99+ "on current platform. Further testing will not be performed" );
100+ }
101+
102+ if (!Desktop .getDesktop ().isSupported (Desktop .Action .MAIL )) {
103+ throw new SkippedException ("Action.MAIL is not supported." );
104+ }
105+
106106 PassFailJFrame .builder ()
107107 .title ("Mail Test" )
108108 .splitUI (MailTest ::new )
0 commit comments