< prev index next >

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

Print this page
@@ -1,7 +1,7 @@
  /*
-  * Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved.
+  * Copyright (c) 2000, 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.

@@ -23,22 +23,22 @@
  
  import java.io.*;
  import java.util.*;
  import java.text.*;
  
+ import org.junit.jupiter.api.Test;
+ 
+ import static org.junit.jupiter.api.Assertions.fail;
+ 
  /**
   * @test
   * @bug 4358730
-  * @library /java/text/testlib
   * @summary test that confirms Zero-Padding on year.
+  * @run junit bug4358730
   */
  
- public class bug4358730 extends IntlTest {
- 
-     public static void main(String[] args) throws Exception {
-         new bug4358730().run(args);
-     }
+ public class bug4358730 {
  
      String[] patterns = {"y",    "yy", "yyy",  "yyyy", "yyyyy"};
      String[][] data = {
          /* 2 A.D. */    {"2",    "02", "002",  "0002", "00002"},
          /* 20 A.D. */   {"20",   "20", "020",  "0020", "00020"},

@@ -48,10 +48,11 @@
      int[] year = {2, 20, 200, 2000};
  
      int datasize = data.length;
      int nPatterns = data[0].length;
  
+     @Test
      public void Test4358730() {
          TimeZone saveZone = TimeZone.getDefault();
          Locale saveLocale = Locale.getDefault();
  
          try {

@@ -63,11 +64,11 @@
                  @SuppressWarnings("deprecation")
                  Date d = new Date(year[i]-1900, 10, 15);
                  for (int j = 0; j < nPatterns; j++) {
                      sdf.applyPattern(patterns[j]);
                      if (!data[i][j].equals(sdf.format(d))) {
-                         errln("Invalid format : " + sdf.format(d) +
+                         fail("Invalid format : " + sdf.format(d) +
                              ", expected : " + data[i][j]);
                      }
                  }
              }
          }
< prev index next >