jdk/test/java/beans/PropertyEditor/TestEnumSubclassValue.java
author ohair
Tue, 25 May 2010 15:58:33 -0700
changeset 5506 202f599c92aa
parent 1845 738a091d8c07
child 31448 1066345d2a8a
permissions -rw-r--r--
6943119: Rebrand source copyright notices Reviewed-by: darcy, weijun
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1845
738a091d8c07 6736248: EnumEditor bug. Class check incorrect
malenkov
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1845
diff changeset
     2
 * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
1845
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
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1845
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1845
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1845
diff changeset
    21
 * questions.
1845
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
}