< prev index next >

test/jdk/java/text/Collator/SurrogatesTest.java

Print this page
*** 1,7 ***
  /*
!  * Copyright (c) 2003, 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) 2003, 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,21 ***
  
  /*
   * @test
   * @library /java/text/testlib
   * @summary test Supplementary Character Collation
   */
  
  import java.text.Collator;
  import java.text.RuleBasedCollator;
  
! // Quick dummy program for printing out test results
- public class SurrogatesTest extends CollatorTest {
  
!     public static void main(String[] args) throws Exception {
!         new SurrogatesTest().run(args);
!     }
  
      /*
       * Data for TestPrimary()
       */
      private static final String[] primarySourceData = {
--- 23,22 ---
  
  /*
   * @test
   * @library /java/text/testlib
   * @summary test Supplementary Character Collation
+  * @run junit SurrogatesTest
   */
  
  import java.text.Collator;
  import java.text.RuleBasedCollator;
  
! import org.junit.jupiter.api.Test;
  
! import static org.junit.jupiter.api.Assertions.fail;
! 
! // Quick dummy program for printing out test results
+ public class SurrogatesTest {
  
      /*
       * Data for TestPrimary()
       */
      private static final String[] primarySourceData = {

*** 81,17 ***
  
      private static final int[] tertiaryResults = {
          -1,  1,  1,  1, -1, -1, -1, -1,  1
      };
  
      public void TestPrimary() {
!         doTest(myCollation, Collator.PRIMARY,
                 primarySourceData, primaryTargetData, primaryResults);
      }
  
      public void TestTertiary() {
!         doTest(myCollation, Collator.TERTIARY,
                 tertiarySourceData, tertiaryTargetData, tertiaryResults);
      }
  
      private Collator getCollator() {
          RuleBasedCollator base = (RuleBasedCollator)Collator.getInstance();
--- 82,19 ---
  
      private static final int[] tertiaryResults = {
          -1,  1,  1,  1, -1, -1, -1, -1,  1
      };
  
+     @Test
      public void TestPrimary() {
!         TestUtils.doCollatorTest(myCollation, Collator.PRIMARY,
                 primarySourceData, primaryTargetData, primaryResults);
      }
  
+     @Test
      public void TestTertiary() {
!         TestUtils.doCollatorTest(myCollation, Collator.TERTIARY,
                 tertiarySourceData, tertiaryTargetData, tertiaryResults);
      }
  
      private Collator getCollator() {
          RuleBasedCollator base = (RuleBasedCollator)Collator.getInstance();

*** 106,11 ***
                                       + "&PE, \ud800\udc09"
                                       + "&Z < \ud800\udc0a < \ud800\udc0b < \ud800\udc0c"
                                       + "&\ud800\udc0a < x, X"
                                       + "&A < \ud800\udc04\ud800\udc05");
          } catch (Exception e) {
!             errln("Failed to create new RulebasedCollator object");
              return null;
          }
      }
  
      private Collator myCollation = getCollator();
--- 109,11 ---
                                       + "&PE, \ud800\udc09"
                                       + "&Z < \ud800\udc0a < \ud800\udc0b < \ud800\udc0c"
                                       + "&\ud800\udc0a < x, X"
                                       + "&A < \ud800\udc04\ud800\udc05");
          } catch (Exception e) {
!             fail("Failed to create new RulebasedCollator object");
              return null;
          }
      }
  
      private Collator myCollation = getCollator();
< prev index next >