< prev index next >

test/jdk/java/text/Format/DateFormat/Bug4322313.java

Print this page
@@ -1,7 +1,7 @@
  /*
-  * Copyright (c) 2001, 2022, Oracle and/or its affiliates. All rights reserved.
+  * Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.

@@ -22,21 +22,26 @@
   */
  
  /**
   * @test
   * @bug 4322313 4833268 6302990 6304305
-  * @library /java/text/testlib
   * @summary Make sure that new implementation for
   * SimpleDateFormat.parse('z' or 'Z') and format('z' or 'Z') work correctly.
+  * @run junit Bug4322313
   */
  
  import java.io.*;
  import java.text.*;
  import java.util.*;
  
- public class Bug4322313 extends IntlTest {
+ import org.junit.jupiter.api.Test;
  
+ import static org.junit.jupiter.api.Assertions.fail;
+ 
+ public class Bug4322313 {
+ 
+     @Test
      public void Test4322313() {
          Locale savedLocale = Locale.getDefault();
          TimeZone savedTimeZone = TimeZone.getDefault();
          boolean err = false;
          long mpm = 60 * 1000;   /* Milliseconds per a minute */

@@ -198,11 +203,11 @@
                                  "/\"" + valids[k][0] +
                                  "\"] expected:" + valids[k][1] +
                                  ", got:" + date.getTime() + ", " + date);
                          } else {
  /*
-                             logln("\tParse  Okay  [Locale=" +
+                             System.out.println("\tParse  Okay  [Locale=" +
                                  locale) + ", " + formats[j] +
                                  "/\"" + valids[k][0] +
                                  "\"] expected:" + valids[k][1] +
                                  ", got:" + date.getTime() + ", " + date);
  */

@@ -250,11 +255,11 @@
                                      formats[j] + "/\"" + valids[k][0] +
                                      "\"] expected:" + valids[k][2+j] +
                                      ", got:" + s + ", " + date);
                              } else {
  /*
-                                 logln("\tFormat Okay  [Locale=" +
+                                 System.out.println("\tFormat Okay  [Locale=" +
                                      locale + ", " +
                                      formats[j] + "/\"" + valids[k][0] +
                                      "\"] expected:" + valids[k][2+j] +
                                      ", got:" + s + ", " + date);
  */

@@ -284,11 +289,11 @@
                                      "/\"" + invalids[k][0] +
                                      "\"] incorrect offset. expected:" +
                                      invalids[k][1] + ", got: " + offset);
                              } else {
  /*
-                                 logln("\tParse  Okay  [Locale=" +
+                                 System.out.println("\tParse  Okay  [Locale=" +
                                      locale + ", " + formats[j] +
                                      "/\"" + invalids[k][0] +
                                      "\"] correct offset: " + offset);
  */
                              }

@@ -320,11 +325,11 @@
                                      "/\"" + invalids[k][0] +
                                      "\"] Expected exception occurred with an incorrect offset. expected:" +
                                      invalids[k][1] + ", got: " + offset);
                              } else {
  /*
-                                 logln("\tParse  Okay  [Locale=" +
+                                 System.out.println("\tParse  Okay  [Locale=" +
                                      locale + ", " + formats[j] +
                                      "/\"" + invalids[k][0] +
                                      "\"] Expected exception occurred with an correct offset: "
                                      + offset);
  */

@@ -352,14 +357,11 @@
          }
          finally {
              Locale.setDefault(savedLocale);
              TimeZone.setDefault(savedTimeZone);
              if (err) {
-                 errln("SimpleDateFormat.parse()/format() test failed");
+                 fail("SimpleDateFormat.parse()/format() test failed");
              }
          }
      }
  
-     public static void main(String[] args) throws Exception {
-         new Bug4322313().run(args);
-     }
  }
< prev index next >