|
150 | 150 | * Before returning from {@code awaitAndCheck}, the framework disposes of |
151 | 151 | * all the windows and frames. |
152 | 152 | * |
| 153 | + * <p id="forcePassAndFail"> |
| 154 | + * For semi-automatic tests, use {@code forcePass} or |
| 155 | + * {@code forceFail} methods to forcibly pass or fail the test |
| 156 | + * when it's determined that the required conditions are already met |
| 157 | + * or cannot be met correspondingly. |
| 158 | + * These methods release {@code awaitAndCheck}, and |
| 159 | + * the test will complete successfully or fail. |
| 160 | + * <p> |
| 161 | + * Refer to examples of using these methods in the description of the |
| 162 | + * {@link #forcePass() forcePass} and {@link #forceFail() forceFail} methods. |
| 163 | + * |
153 | 164 | * <h2 id="sampleManualTest">Sample Manual Test</h2> |
154 | 165 | * A simple test would look like this: |
155 | 166 | * {@snippet id='sampleManualTestCode' lang='java': |
@@ -1310,14 +1321,34 @@ public static void forcePass() { |
1310 | 1321 | } |
1311 | 1322 |
|
1312 | 1323 | /** |
1313 | | - * Forcibly fail the test. |
| 1324 | + * Forcibly fail the test. |
| 1325 | + * <p> |
| 1326 | + * Use this method in semi-automatic tests when |
| 1327 | + * it is determined that the conditions for passing the test cannot be met. |
| 1328 | + * <p> |
| 1329 | + * <strong>Do not use</strong> this method in cases where a resource is unavailable or a |
| 1330 | + * feature isn't supported, throw {@code jtreg.SkippedException} instead. |
| 1331 | + * |
| 1332 | + * <p>A sample usage can be found in |
| 1333 | + * <a href="https://github.com/openjdk/jdk/blob/0844745e7bd954a96441365f8010741ec1c29dbf/test/jdk/javax/swing/JScrollPane/AcceleratedWheelScrolling/HorizScrollers.java#L180">{@code |
| 1334 | + * HorizScrollers.java}</a> |
1314 | 1335 | */ |
1315 | 1336 | public static void forceFail() { |
1316 | 1337 | forceFail("forceFail called"); |
1317 | 1338 | } |
1318 | 1339 |
|
1319 | 1340 | /** |
1320 | | - * Forcibly fail the test and provide a reason. |
| 1341 | + * Forcibly fail the test and provide a reason. |
| 1342 | + * <p> |
| 1343 | + * Use this method in semi-automatic tests when |
| 1344 | + * it is determined that the conditions for passing the test cannot be met. |
| 1345 | + * <p> |
| 1346 | + * <strong>Do not use</strong> this method in cases where a resource is unavailable or a |
| 1347 | + * feature isn't supported, throw {@code jtreg.SkippedException} instead. |
| 1348 | + * |
| 1349 | + * <p>A sample usage can be found in |
| 1350 | + * <a href="https://github.com/openjdk/jdk/blob/7283c8b075aa289dbb9cb80f6937b3349c8d4769/test/jdk/java/awt/FileDialog/SaveFileNameOverrideTest.java#L86">{@code |
| 1351 | + * SaveFileNameOverrideTest.java}</a> |
1321 | 1352 | * |
1322 | 1353 | * @param reason the reason why the test is failed |
1323 | 1354 | */ |
|
0 commit comments