jdk/test/javax/management/MBeanInfo/MBeanInfoEqualsNPETest.java
author stefank
Fri, 17 Apr 2015 17:10:38 +0000
changeset 30266 ef82cd1f2db3
parent 20174 360791181f66
child 30376 2ccf2cf7ea48
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
20174
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
     1
/*
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
     2
 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
     4
 *
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
     7
 * published by the Free Software Foundation.
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
     8
 *
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    13
 * accompanied this code).
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    14
 *
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    18
 *
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    21
 * questions.
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    22
 */
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    23
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    24
import javax.management.MBeanAttributeInfo;
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    25
import javax.management.MBeanConstructorInfo;
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    26
import javax.management.MBeanFeatureInfo;
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    27
import javax.management.MBeanInfo;
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    28
import javax.management.MBeanNotificationInfo;
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    29
import javax.management.MBeanOperationInfo;
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    30
import javax.management.MBeanParameterInfo;
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    31
import javax.management.modelmbean.DescriptorSupport;
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    32
import javax.management.openmbean.SimpleType;
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    33
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    34
/*
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    35
 * @test
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    36
 * @bug 8023954
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    37
 * @summary Test that MBean*Info.equals do not throw NPE
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    38
 * @author Shanliang JIANG
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    39
 * @run clean MBeanInfoEqualsNPETest
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    40
 * @run build MBeanInfoEqualsNPETest
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    41
 * @run main MBeanInfoEqualsNPETest
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    42
 */
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    43
public class MBeanInfoEqualsNPETest {
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    44
    private static int failed = 0;
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    45
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    46
    public static void main(String[] args) throws Exception {
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    47
        System.out.println("---MBeanInfoEqualsNPETest-main ...");
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    48
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    49
        // ----
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    50
        System.out.println("\n---Testing on MBeanAttributeInfo...");
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    51
        MBeanAttributeInfo mbeanAttributeInfo0 = new MBeanAttributeInfo(
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    52
                "name", SimpleType.INTEGER.getClassName(), "description", true, true, false);
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    53
        MBeanAttributeInfo mbeanAttributeInfo = new MBeanAttributeInfo(
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    54
                null, SimpleType.INTEGER.getClassName(), "description", true, true, false);
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    55
        test(mbeanAttributeInfo0, mbeanAttributeInfo, "class name");
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    56
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    57
        mbeanAttributeInfo = new MBeanAttributeInfo(
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    58
                "name", null, "description", true, true, false);
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    59
        test(mbeanAttributeInfo0, mbeanAttributeInfo, "type");
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    60
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    61
        mbeanAttributeInfo = new MBeanAttributeInfo(
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    62
                "name", SimpleType.INTEGER.getClassName(), null, true, true, false);
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    63
        test(mbeanAttributeInfo0, mbeanAttributeInfo, "description");
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    64
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    65
        // ----
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    66
        System.out.println("\n---Testing on MBeanConstructorInfo...");
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    67
        MBeanConstructorInfo mbeanConstructorInfo0 = new MBeanConstructorInfo(
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    68
                "", "", new MBeanParameterInfo[]{}, new DescriptorSupport());
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    69
        MBeanConstructorInfo mbeanConstructorInfo = new MBeanConstructorInfo(
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    70
                null, "", new MBeanParameterInfo[]{}, new DescriptorSupport());
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    71
        test(mbeanConstructorInfo0, mbeanConstructorInfo, "name");
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    72
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    73
        mbeanConstructorInfo = new MBeanConstructorInfo(
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    74
                "", null, new MBeanParameterInfo[]{}, new DescriptorSupport());
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    75
        test(mbeanConstructorInfo0, mbeanConstructorInfo, "description");
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    76
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    77
        mbeanConstructorInfo = new MBeanConstructorInfo(
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    78
                "", "", null, new DescriptorSupport());
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    79
        test(mbeanConstructorInfo0, mbeanConstructorInfo, "MBeanParameterInfo");
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    80
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    81
        mbeanConstructorInfo = new MBeanConstructorInfo(
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    82
                "", "", new MBeanParameterInfo[]{}, null);
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    83
        test(mbeanConstructorInfo0, mbeanConstructorInfo, "descriptor");
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    84
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    85
        // ----
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    86
        System.out.println("\n---Testing on MBeanOperationInfo...");
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    87
        MBeanOperationInfo mbeanOperationInfo0 = new MBeanOperationInfo(
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    88
                "name", "description", new MBeanParameterInfo[]{}, "type",
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    89
                MBeanOperationInfo.UNKNOWN, new DescriptorSupport());
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    90
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    91
        MBeanOperationInfo mbeanOperationInfo = new MBeanOperationInfo(
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    92
                null, "description", new MBeanParameterInfo[]{}, "type",
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    93
                MBeanOperationInfo.UNKNOWN, new DescriptorSupport());
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    94
        test(mbeanOperationInfo0, mbeanOperationInfo, "name");
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    95
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    96
        mbeanOperationInfo = new MBeanOperationInfo(
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    97
                "name", null, new MBeanParameterInfo[]{}, "type",
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    98
                MBeanOperationInfo.UNKNOWN, new DescriptorSupport());
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
    99
        test(mbeanOperationInfo0, mbeanOperationInfo, "description");
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   100
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   101
        mbeanOperationInfo = new MBeanOperationInfo(
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   102
                "name", "description", null, "type", 1, new DescriptorSupport());
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   103
        test(mbeanOperationInfo0, mbeanOperationInfo, "MBeanParameterInfo");
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   104
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   105
        mbeanOperationInfo = new MBeanOperationInfo(
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   106
                "name", "description", new MBeanParameterInfo[]{}, null,
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   107
                MBeanOperationInfo.UNKNOWN, new DescriptorSupport());
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   108
        test(mbeanOperationInfo0, mbeanOperationInfo, "type");
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   109
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   110
        mbeanOperationInfo = new MBeanOperationInfo(
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   111
                "name", "description", new MBeanParameterInfo[]{}, null,
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   112
                MBeanOperationInfo.UNKNOWN, null);
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   113
        test(mbeanOperationInfo0, mbeanOperationInfo, "Descriptor");
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   114
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   115
        // ----
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   116
        System.out.println("\n---Testing on MBeanParameterInfo...");
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   117
        MBeanParameterInfo mbeanParameterInfo0 = new MBeanParameterInfo(
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   118
                "name", "type", "description", new DescriptorSupport());
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   119
        MBeanParameterInfo mbeanParameterInfo = new MBeanParameterInfo(
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   120
                null, "type", "description", new DescriptorSupport());
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   121
        test(mbeanParameterInfo0, mbeanParameterInfo, "name");
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   122
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   123
        mbeanParameterInfo = new MBeanParameterInfo(
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   124
                "name", null, "description", new DescriptorSupport());
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   125
        test(mbeanParameterInfo0, mbeanParameterInfo, "type");
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   126
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   127
        mbeanParameterInfo = new MBeanParameterInfo(
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   128
                "name", "type", null, new DescriptorSupport());
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   129
        test(mbeanParameterInfo0, mbeanParameterInfo, "description");
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   130
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   131
        mbeanParameterInfo = new MBeanParameterInfo(
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   132
                "name", "type", "description", null);
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   133
        test(mbeanParameterInfo0, mbeanParameterInfo, "Descriptor");
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   134
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   135
        // ----
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   136
        System.out.println("\n---Testing on MBeanFeatureInfo ...");
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   137
        MBeanFeatureInfo mbeanFeatureInfo0 = new MBeanFeatureInfo(
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   138
                "name", "description", new DescriptorSupport());
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   139
        MBeanFeatureInfo mbeanFeatureInfo = new MBeanFeatureInfo(
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   140
                null, "description", new DescriptorSupport());
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   141
        test(mbeanFeatureInfo0, mbeanFeatureInfo, "name");
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   142
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   143
        mbeanFeatureInfo = new MBeanFeatureInfo(
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   144
                "name", null, new DescriptorSupport());
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   145
        test(mbeanParameterInfo0, mbeanParameterInfo, "description");
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   146
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   147
        mbeanFeatureInfo = new MBeanFeatureInfo(
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   148
                "name", "description", null);
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   149
        test(mbeanParameterInfo0, mbeanParameterInfo, "Descriptor");
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   150
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   151
        // ----
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   152
        System.out.println("\n---Testing on MBeanInfo...");
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   153
        String className = "toto";
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   154
        String description = "titi";
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   155
        MBeanAttributeInfo[] attrInfos = new MBeanAttributeInfo[]{};
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   156
        MBeanConstructorInfo[] constrInfos = new MBeanConstructorInfo[]{};
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   157
        MBeanOperationInfo[] operaInfos = new MBeanOperationInfo[]{};
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   158
        MBeanNotificationInfo[] notifInfos = new MBeanNotificationInfo[]{};
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   159
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   160
        MBeanInfo minfo0 = new MBeanInfo("toto", description, attrInfos, constrInfos, operaInfos, notifInfos);
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   161
        MBeanInfo minfo = new MBeanInfo(null, description, attrInfos, constrInfos, operaInfos, notifInfos);
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   162
        test(minfo0, minfo, "class name");
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   163
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   164
        minfo = new MBeanInfo(className, null, attrInfos, constrInfos, operaInfos, notifInfos);
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   165
        test(minfo0, minfo, "description");
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   166
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   167
        minfo = new MBeanInfo(className, description, null, constrInfos, operaInfos, notifInfos);
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   168
        test(minfo0, minfo, "attrInfos");
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   169
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   170
        minfo = new MBeanInfo(className, description, attrInfos, null, operaInfos, notifInfos);
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   171
        test(minfo0, minfo, "constrInfos");
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   172
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   173
        minfo = new MBeanInfo(className, description, attrInfos, constrInfos, null, notifInfos);
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   174
        test(minfo0, minfo, "operaInfos");
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   175
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   176
        minfo = new MBeanInfo(className, description, attrInfos, constrInfos, operaInfos, null);
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   177
        test(minfo0, minfo, "notifInfos");
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   178
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   179
        if (failed > 0) {
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   180
            throw new RuntimeException("Test failed: "+failed);
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   181
        } else {
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   182
            System.out.println("---Test: PASSED");
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   183
        }
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   184
    }
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   185
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   186
    private static void test(Object obj1, Object obj2, String param) {
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   187
        try {
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   188
            obj1.equals(obj2);
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   189
            System.out.println("OK-1: "+obj1.getClass().getSimpleName()+".equals worked with a null paramer: "+param);
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   190
        } catch (NullPointerException npe) {
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   191
            System.out.println("--->KO-1!!! "+obj1.getClass().getSimpleName()+".equals got NPE with a null paramer: "+param);
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   192
            npe.printStackTrace();
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   193
            failed++;
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   194
        }
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   195
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   196
        try {
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   197
            obj2.equals(obj1);
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   198
            System.out.println("OK-2: "+obj2.getClass().getSimpleName()+".equals worked with a null paramer: "+param);
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   199
        } catch (NullPointerException npe) {
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   200
            System.out.println("--->KO-2!!! "+obj2.getClass().getSimpleName()+".equals got NPE with a null paramer: "+param);
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   201
            npe.printStackTrace();
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   202
            failed++;
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   203
        }
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   204
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   205
        try {
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   206
            obj1.equals(null);
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   207
            obj2.equals(null);
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   208
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   209
            System.out.println("OK-3: "+obj1.getClass().getSimpleName()+".equals worked with a null field.");
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   210
        } catch (NullPointerException npe) {
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   211
            System.out.println("--->KO-3!!! "+obj1.getClass().getSimpleName()+".equals got NPE with a null field.");
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   212
            npe.printStackTrace();
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   213
            failed++;
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   214
        }
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   215
    }
360791181f66 8023954: MBean*Info.equals: throw NPE
sjiang
parents:
diff changeset
   216
}