EqualsTest.java revision 1914
0N/A/*
3261N/A * Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
2362N/A * CA 95054 USA or visit www.sun.com if you need additional information or
2362N/A * have any questions.
0N/A */
0N/A
0N/A/*
0N/A * @test
0N/A * @bug 6842557
0N/A * @summary confirm that an instance which is created with new Enum ranges is
0N/A * equivalent to another instance which is created with equivalent traditional
0N/A * ranges or the same Enum ranges.
0N/A */
0N/A
0N/Aimport java.awt.font.NumericShaper;
0N/Aimport java.util.EnumSet;
0N/Aimport static java.awt.font.NumericShaper.*;
0N/A
0N/Apublic class EqualsTest {
0N/A public static void main(String[] args) {
2497N/A NumericShaper ns1 = getContextualShaper(ARABIC | TAMIL, TAMIL);
2497N/A NumericShaper ns2 = getContextualShaper(
2497N/A EnumSet.of(Range.ARABIC, Range.TAMIL),
2497N/A Range.TAMIL);
2497N/A NumericShaper ns3 = getContextualShaper(
2497N/A EnumSet.of(Range.ARABIC, Range.TAMIL),
2497N/A Range.TAMIL);
2497N/A NumericShaper ns4 = getContextualShaper(
2497N/A EnumSet.of(Range.ARABIC, Range.TAMIL),
0N/A Range.ARABIC);
0N/A
0N/A if (!ns1.equals(ns2)) {
0N/A throw new RuntimeException("ns1 != ns2: ns1=" + ns1 + ", ns2=" + ns2);
}
if (!ns2.equals(ns1)) {
throw new RuntimeException("ns2 != ns1: ns1=" + ns1 + ", ns2=" + ns2);
}
if (!ns2.equals(ns3)) {
throw new RuntimeException("ns2 != ns3: ns2=" + ns2 + ", ns3=" + ns3);
}
if (ns1.equals(ns4)) {
throw new RuntimeException("ns1 == ns4: ns1=" + ns1 + ", ns4=" + ns4);
}
if (ns2.equals(ns4)) {
throw new RuntimeException("ns2 == ns4: ns2=" + ns2 + ", ns4=" + ns4);
}
}
}