1
1
/*
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.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
21
21
* questions.
22
22
*/
23
23
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
+
24
32
/*
25
33
* @test
26
34
* @bug 6255196
27
35
* @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
30
38
* @run main/manual MailTest
31
39
*/
32
40
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
-
39
41
public class MailTest extends JPanel {
40
42
41
43
static final String INSTRUCTIONS = """
@@ -48,18 +50,7 @@ public class MailTest extends JPanel {
48
50
""" ;
49
51
50
52
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
-
57
53
Desktop desktop = Desktop .getDesktop ();
58
- if (!desktop .isSupported (Desktop .Action .MAIL )) {
59
- PassFailJFrame .log ("Action.MAIL is not supported." );
60
- PassFailJFrame .forcePass ();
61
- }
62
-
63
54
/*
64
55
* Part 1: launch the mail composing window without a mailto URI.
65
56
*/
@@ -103,6 +94,15 @@ private MailTest() {
103
94
104
95
public static void main (String [] args ) throws InterruptedException ,
105
96
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
+
106
106
PassFailJFrame .builder ()
107
107
.title ("Mail Test" )
108
108
.splitUI (MailTest ::new )
0 commit comments