< prev index next >

test/jdk/java/text/Collator/Bug6271411.java

Print this page
*** 1,7 ***
  /*
!  * Copyright (c) 2005, 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) 2005, 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,25 ***
   */
  
  /*
   * @test
   * @bug 6271411
-  * @library /java/text/testlib
   * @summary Confirm that three JCK testcases for CollationElementIterator pass.
   */
  
  import java.text.*;
  
  /*
   * Based on JCK-runtime-15/tests/api/java_text/CollationElementIterator/ColltnElmtIterTests.java.
   */
! public class Bug6271411 extends IntlTest {
- 
-     public static void main(String argv[]) throws Exception {
-         Bug6271411 test = new Bug6271411();
-         test.run(argv);
-     }
  
      /*
       * Rule for RuleBasedCollator
       */
      static final String rule = "< c, C < d; D";
--- 22,24 ---
   */
  
  /*
   * @test
   * @bug 6271411
   * @summary Confirm that three JCK testcases for CollationElementIterator pass.
+  * @run junit Bug6271411
   */
  
  import java.text.*;
  
+ import org.junit.jupiter.api.Test;
+ 
+ import static org.junit.jupiter.api.Assertions.fail;
+ 
  /*
   * Based on JCK-runtime-15/tests/api/java_text/CollationElementIterator/ColltnElmtIterTests.java.
   */
! public class Bug6271411 {
  
      /*
       * Rule for RuleBasedCollator
       */
      static final String rule = "< c, C < d; D";

*** 56,10 ***
--- 55,11 ---
      /*
       * Confirm that setOffset() throws IllegalArgumentException
       * (not IndexOutOfBoundsException) if the given offset is invalid.
       * Use CollationElementIterator.setText(String).
       */
+     @Test
      public void Test_CollationElementIterator0007() throws Exception {
          int[] offsets = {
              Integer.MIN_VALUE, Integer.MIN_VALUE + 1, -10000, -2, -1,
              100, 101, // These two are customized for every test data later.
              12345, Integer.MAX_VALUE - 1, Integer.MAX_VALUE

*** 88,19 ***
                  }
              }
          }
  
          if (err) {
!             errln("CollationElementIterator.setOffset() didn't throw an expected IllegalArguemntException.");
          }
      }
  
      /*
       * Confirm that setText() doesn't throw an exception and setOffset() throws
       * IllegalArgumentException if the given offset is invalid.
       * Use CollationElementIterator.setText(CharacterIterator).
       */
      public void Test_CollationElementIterator0010() throws Exception {
          String prefix = "xyz abc";
          String suffix = "1234567890";
          int begin = prefix.length();
          int[] offsets = {
--- 88,20 ---
                  }
              }
          }
  
          if (err) {
!             fail("CollationElementIterator.setOffset() didn't throw an expected IllegalArguemntException.");
          }
      }
  
      /*
       * Confirm that setText() doesn't throw an exception and setOffset() throws
       * IllegalArgumentException if the given offset is invalid.
       * Use CollationElementIterator.setText(CharacterIterator).
       */
+     @Test
      public void Test_CollationElementIterator0010() throws Exception {
          String prefix = "xyz abc";
          String suffix = "1234567890";
          int begin = prefix.length();
          int[] offsets = {

*** 142,19 ***
                  }
              }
          }
  
          if (err) {
!             errln("CollationElementIterator.setOffset() didn't throw an expected IllegalArguemntException.");
          }
      }
  
      /*
       * Confirm that setText() doesn't throw an exception and setOffset() sets
       * an offset as expected.
       * Use CollationElementIterator.setText(CharacterIterator).
       */
      public void Test_CollationElementIterator0011() throws Exception {
          String prefix = "xyz abc";
          String suffix = "1234567890";
          int begin = prefix.length();
          int[] offsets = { begin, begin + 1, 2, 3, 4 };
--- 143,20 ---
                  }
              }
          }
  
          if (err) {
!             fail("CollationElementIterator.setOffset() didn't throw an expected IllegalArguemntException.");
          }
      }
  
      /*
       * Confirm that setText() doesn't throw an exception and setOffset() sets
       * an offset as expected.
       * Use CollationElementIterator.setText(CharacterIterator).
       */
+     @Test
      public void Test_CollationElementIterator0011() throws Exception {
          String prefix = "xyz abc";
          String suffix = "1234567890";
          int begin = prefix.length();
          int[] offsets = { begin, begin + 1, 2, 3, 4 };
< prev index next >