1 /*
  2  * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
  3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4  *
  5  * This code is free software; you can redistribute it and/or modify it
  6  * under the terms of the GNU General Public License version 2 only, as
  7  * published by the Free Software Foundation.
  8  *
  9  * This code is distributed in the hope that it will be useful, but WITHOUT
 10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  */
 23 
 24 /*
 25  * @test
 26  * @library /java/text/testlib
 27  * @summary test German Collation
 28  * @run junit GermanTest
 29  */
 30 /*
 31 (C) Copyright Taligent, Inc. 1996 - All Rights Reserved
 32 (C) Copyright IBM Corp. 1996 - All Rights Reserved
 33 
 34   The original version of this source code and documentation is copyrighted and
 35 owned by Taligent, Inc., a wholly-owned subsidiary of IBM. These materials are
 36 provided under terms of a License Agreement between Taligent and Sun. This
 37 technology is protected by multiple US and International patents. This notice and
 38 attribution to Taligent may not be removed.
 39   Taligent is a registered trademark of Taligent, Inc.
 40 */
 41 
 42 import java.util.Locale;
 43 import java.text.Collator;
 44 
 45 import org.junit.jupiter.api.Test;
 46 
 47 import static org.junit.jupiter.api.Assertions.fail;
 48 
 49 // Quick dummy program for printing out test results
 50 public class GermanTest {
 51 
 52     /*
 53      * Shared data for TestPrimary() and TestTertiary()
 54      */
 55     private static final String testSourceData[] = {
 56         "Gr\u00F6\u00DFe",
 57         "abc",
 58         "T\u00F6ne",
 59         "T\u00F6ne",
 60         "T\u00F6ne",
 61         "a\u0308bc",
 62         "\u00E4bc",
 63         "\u00E4bc",
 64         "Stra\u00DFe",
 65         "efg",
 66         "\u00E4bc",
 67         "Stra\u00DFe"
 68     };
 69 
 70     private static final String testTargetData[] = {
 71         "Grossist",
 72         "a\u0308bc",
 73         "Ton",
 74         "Tod",
 75         "Tofu",
 76         "A\u0308bc",
 77         "a\u0308bc",
 78         "aebc",
 79         "Strasse",
 80         "efg",
 81         "aebc",
 82         "Strasse"
 83     };
 84 
 85     /*
 86      * Data for TestPrimary()
 87      */
 88     private static final int[] primaryResults = {
 89         -1,  0,  1,  1,  1,  0,  0, -1,  0,  0,
 90         -1,  0
 91     };
 92 
 93     /*
 94      * Data for TestTertiary()
 95      */
 96     private static final int[] tertiaryResults = {
 97         -1, -1,  1,  1,  1, -1,  0, -1,  1,  0,
 98         -1,  1
 99     };
100 
101     @Test
102     public void TestPrimary() {
103         TestUtils.doCollatorTest(myCollation, Collator.PRIMARY,
104                testSourceData, testTargetData, primaryResults);
105     }
106 
107     @Test
108     public void TestTertiary() {
109         TestUtils.doCollatorTest(myCollation, Collator.TERTIARY,
110                testSourceData, testTargetData, tertiaryResults);
111     }
112 
113     private final Collator myCollation = Collator.getInstance(Locale.GERMAN);
114 }