jdk/test/java/beans/PropertyEditor/TestEnumSubclassValue.java
author malenkov
Thu, 25 Dec 2008 20:43:44 +0300
changeset 1845 738a091d8c07
child 5506 202f599c92aa
permissions -rw-r--r--
6736248: EnumEditor bug. Class check incorrect Reviewed-by: rupashka, alexp
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1845
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
     1
/*
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
     2
 * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
     4
 *
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
     7
 * published by the Free Software Foundation.
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
     8
 *
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    13
 * accompanied this code).
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    14
 *
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    18
 *
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    21
 * have any questions.
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    22
 */
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    23
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    24
/*
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    25
 * @test
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    26
 * @bug 6736248
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    27
 * @summary Tests PropertyEditor for value of subtype Enum
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    28
 * @author Sergey Malenkov
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    29
 */
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    30
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    31
public class TestEnumSubclassValue {
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    32
    public static void main(String[] args) {
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    33
        TestEditor test = new TestEditor(Operation.class);
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    34
        test.testValue(Operation.PLUS, "PLUS");
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    35
        test.testValue(null, null);
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    36
        test.testText("MINUS", Operation.MINUS);
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    37
        test.testText(null, null);
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    38
    }
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    39
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    40
    public enum Operation {
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    41
        PLUS {
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    42
            public int run(int i, int j) {
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    43
                return i + j;
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    44
            }
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    45
        },
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    46
        MINUS {
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    47
            public int run(int i, int j) {
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    48
                return i - j;
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    49
            }
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    50
        };
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    51
        public abstract int run(int i, int j);
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    52
    }
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
    53
}