< prev index next >

test/jdk/java/text/Collator/DummyTest.java

Print this page
*** 1,7 ***
  /*
!  * Copyright (c) 1997, 2016, 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.
--- 1,7 ---
  /*
!  * Copyright (c) 1997, 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,15 ***
--- 23,20 ---
  
  /*
   * @test
   * @library /java/text/testlib
   * @summary test Dummy Collation
+  * @run junit DummyTest
   */
  
  import java.text.Collator;
  import java.text.RuleBasedCollator;
  
+ import org.junit.jupiter.api.Test;
+ 
+ import static org.junit.jupiter.api.Assertions.fail;
+ 
  /*
  (C) Copyright Taligent, Inc. 1996 - All Rights Reserved
  (C) Copyright IBM Corp. 1996 - All Rights Reserved
  
    The original version of this source code and documentation is copyrighted and

*** 40,15 ***
  technology is protected by multiple US and International patents. This notice and
  attribution to Taligent may not be removed.
    Taligent is a registered trademark of Taligent, Inc.
  */
  
! public class DummyTest extends CollatorTest {
- 
-     public static void main(String[] args) throws Exception {
-         new DummyTest().run(args);
-     }
  
      private static final String DEFAULTRULES =
          "='\u200B'=\u200C=\u200D=\u200E=\u200F"
          // Control Characters
          + "=\u0000 =\u0001 =\u0002 =\u0003 =\u0004" //null, .. eot
--- 45,11 ---
  technology is protected by multiple US and International patents. This notice and
  attribution to Taligent may not be removed.
    Taligent is a registered trademark of Taligent, Inc.
  */
  
! public class DummyTest {
  
      private static final String DEFAULTRULES =
          "='\u200B'=\u200C=\u200D=\u200E=\u200F"
          // Control Characters
          + "=\u0000 =\u0001 =\u0002 =\u0003 =\u0004" //null, .. eot

*** 380,29 ***
          "b",
          "c",
          "z"
      };
  
      public void TestPrimary() {
!         doTest(getCollator(), Collator.PRIMARY,
                 primarySourceData, primaryTargetData, primaryResults);
      }
  
      public void TestSecondary() {
!         doTest(getCollator(), Collator.SECONDARY,
                 secondarySourceData, secondaryTargetData, secondaryResults);
      }
  
      public void TestTertiary() {
          Collator col = getCollator();
  
!         doTest(col, Collator.TERTIARY,
                 tertiarySourceData, tertiaryTargetData, tertiaryResults);
  
          for (int i = 0; i < testData.length-1; i++) {
              for (int j = i+1; j < testData.length; j++) {
!                 doTest(col, testData[i], testData[j], -1);
              }
          }
      }
  
      private RuleBasedCollator myCollation = null;
--- 381,32 ---
          "b",
          "c",
          "z"
      };
  
+     @Test
      public void TestPrimary() {
!         TestUtils.doCollatorTest(getCollator(), Collator.PRIMARY,
                 primarySourceData, primaryTargetData, primaryResults);
      }
  
+     @Test
      public void TestSecondary() {
!         TestUtils.doCollatorTest(getCollator(), Collator.SECONDARY,
                 secondarySourceData, secondaryTargetData, secondaryResults);
      }
  
+     @Test
      public void TestTertiary() {
          Collator col = getCollator();
  
!         TestUtils.doCollatorTest(col, Collator.TERTIARY,
                 tertiarySourceData, tertiaryTargetData, tertiaryResults);
  
          for (int i = 0; i < testData.length-1; i++) {
              for (int j = i+1; j < testData.length; j++) {
!                 TestUtils.doCollatorTest(col, testData[i], testData[j], -1);
              }
          }
      }
  
      private RuleBasedCollator myCollation = null;

*** 410,11 ***
          if (myCollation == null) {
              try {
                  myCollation = new RuleBasedCollator
                      (DEFAULTRULES + "& C < ch, cH, Ch, CH & Five, 5 & Four, 4 & one, 1 & Ampersand; '&' & Two, 2 ");
              } catch (Exception foo) {
!                 errln("Collator creation failed.");
                  myCollation = (RuleBasedCollator)Collator.getInstance();
              }
          }
          return myCollation;
      }
--- 414,11 ---
          if (myCollation == null) {
              try {
                  myCollation = new RuleBasedCollator
                      (DEFAULTRULES + "& C < ch, cH, Ch, CH & Five, 5 & Four, 4 & one, 1 & Ampersand; '&' & Two, 2 ");
              } catch (Exception foo) {
!                 fail("Collator creation failed.");
                  myCollation = (RuleBasedCollator)Collator.getInstance();
              }
          }
          return myCollation;
      }
< prev index next >