From 68f72e4684b703c79853739c43009db225e8173e Mon Sep 17 00:00:00 2001 From: Manukumar V S Date: Wed, 7 May 2025 17:56:46 +0530 Subject: [PATCH 1/3] 8355515: Clarify the purpose of forcePass() and forceFail() methods --- .../awt/regtesthelpers/PassFailJFrame.java | 33 +++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/test/jdk/java/awt/regtesthelpers/PassFailJFrame.java b/test/jdk/java/awt/regtesthelpers/PassFailJFrame.java index 0c3748bf832d0..031395aaf25dd 100644 --- a/test/jdk/java/awt/regtesthelpers/PassFailJFrame.java +++ b/test/jdk/java/awt/regtesthelpers/PassFailJFrame.java @@ -149,6 +149,15 @@ *

* Before returning from {@code awaitAndCheck}, the framework disposes of * all the windows and frames. + *

+ * There are two other static methods available, + * {@link #forcePass() forcePass} and {@link #forceFail() forceFail}, which can + * be used in semi-automated tests to indicate that the test can be forcefully + * Passed/Failed. These methods are not immediately evaluated, but it decrements + * a counter and return. The evaluation happens in {@code awaitAndCheck} and + * the test will be forcefully Passed/Failed accordingly. + * Code examples are given in the corresponding method javadoc. + *

* *

Sample Manual Test

* A simple test would look like this: @@ -1310,14 +1319,34 @@ public static void forcePass() { } /** - * Forcibly fail the test. + * Forcibly fail the test. + *

+ * Use this method in semi-automatic tests when + * the test determines that all/any of the conditions for passing the test are not met. + *

+ * Do not use this method in cases where a resource is unavailable or a + * feature isn't supported, throw {@code jtreg.SkippedException} instead. + * + *

A sample usage can be found in + * {@code + * HorizScrollers.java} */ public static void forceFail() { forceFail("forceFail called"); } /** - * Forcibly fail the test and provide a reason. + * Forcibly fail the test and provide a reason. + *

+ * Use this method in semi-automatic tests when + * the test determines that all/any of the conditions for passing the test are not met. + *

+ * Do not use this method in cases where a resource is unavailable or a + * feature isn't supported, throw {@code jtreg.SkippedException} instead. + * + *

A sample usage can be found in + * {@code + * SaveFileNameOverrideTest.java} * * @param reason the reason why the test is failed */ From 9f0a6321f5d0029c44c771091991a7c47d765a4c Mon Sep 17 00:00:00 2001 From: Manukumar V S Date: Sun, 18 May 2025 18:44:47 +0530 Subject: [PATCH 2/3] Review comments fixed : Formatting changes, wordings changed --- .../awt/regtesthelpers/PassFailJFrame.java | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/test/jdk/java/awt/regtesthelpers/PassFailJFrame.java b/test/jdk/java/awt/regtesthelpers/PassFailJFrame.java index 031395aaf25dd..fa8bffb6e318a 100644 --- a/test/jdk/java/awt/regtesthelpers/PassFailJFrame.java +++ b/test/jdk/java/awt/regtesthelpers/PassFailJFrame.java @@ -149,15 +149,17 @@ *

* Before returning from {@code awaitAndCheck}, the framework disposes of * all the windows and frames. + * *

- * There are two other static methods available, - * {@link #forcePass() forcePass} and {@link #forceFail() forceFail}, which can - * be used in semi-automated tests to indicate that the test can be forcefully - * Passed/Failed. These methods are not immediately evaluated, but it decrements - * a counter and return. The evaluation happens in {@code awaitAndCheck} and - * the test will be forcefully Passed/Failed accordingly. - * Code examples are given in the corresponding method javadoc. + * For semi-automatic tests, use {@code forcePass} or + * {@code forceFail} methods to forcefully pass or fail the test + * when it's determined that the required conditions are already met + * or cannot be met correspondingly. + * These methods release {@code awaitAndCheck}, and + * the test will complete successfully or fail. *

+ * Refer to examples of using these methods in the description of the + * {@link #forcePass() forcePass} and {@link #forceFail() forceFail} methods. * *

Sample Manual Test

* A simple test would look like this: @@ -1302,7 +1304,7 @@ private static synchronized void showUI() { /** - * Forcibly pass the test. + * Forcefully pass the test. *

* Use this method in semi-automatic tests when * the test determines that all the conditions for passing the test are met. @@ -1319,10 +1321,10 @@ public static void forcePass() { } /** - * Forcibly fail the test. + * Forcefully fail the test. *

* Use this method in semi-automatic tests when - * the test determines that all/any of the conditions for passing the test are not met. + * it is determined that the conditions for passing the test cannot be met. *

* Do not use this method in cases where a resource is unavailable or a * feature isn't supported, throw {@code jtreg.SkippedException} instead. @@ -1336,10 +1338,10 @@ public static void forceFail() { } /** - * Forcibly fail the test and provide a reason. + * Forcefully fail the test and provide a reason. *

* Use this method in semi-automatic tests when - * the test determines that all/any of the conditions for passing the test are not met. + * it is determined that the conditions for passing the test cannot be met. *

* Do not use this method in cases where a resource is unavailable or a * feature isn't supported, throw {@code jtreg.SkippedException} instead. From ff288f0eb783215eabcfbe97a3d382fff91d7c76 Mon Sep 17 00:00:00 2001 From: Manukumar V S Date: Mon, 19 May 2025 18:23:57 +0530 Subject: [PATCH 3/3] Review comments fixed : Forcibly wordings changed --- test/jdk/java/awt/regtesthelpers/PassFailJFrame.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/jdk/java/awt/regtesthelpers/PassFailJFrame.java b/test/jdk/java/awt/regtesthelpers/PassFailJFrame.java index fa8bffb6e318a..c0a483056df0c 100644 --- a/test/jdk/java/awt/regtesthelpers/PassFailJFrame.java +++ b/test/jdk/java/awt/regtesthelpers/PassFailJFrame.java @@ -152,7 +152,7 @@ * *

* For semi-automatic tests, use {@code forcePass} or - * {@code forceFail} methods to forcefully pass or fail the test + * {@code forceFail} methods to forcibly pass or fail the test * when it's determined that the required conditions are already met * or cannot be met correspondingly. * These methods release {@code awaitAndCheck}, and @@ -1304,7 +1304,7 @@ private static synchronized void showUI() { /** - * Forcefully pass the test. + * Forcibly pass the test. *

* Use this method in semi-automatic tests when * the test determines that all the conditions for passing the test are met. @@ -1321,7 +1321,7 @@ public static void forcePass() { } /** - * Forcefully fail the test. + * Forcibly fail the test. *

* Use this method in semi-automatic tests when * it is determined that the conditions for passing the test cannot be met. @@ -1338,7 +1338,7 @@ public static void forceFail() { } /** - * Forcefully fail the test and provide a reason. + * Forcibly fail the test and provide a reason. *

* Use this method in semi-automatic tests when * it is determined that the conditions for passing the test cannot be met.