Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/java/beans/XMLEncoder/Test4993777.java
38812 views
/*1* Copyright (c) 2006, 2007, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24* @test25* @bug 499377726* @summary Tests encoding of multi-dimensional arrays27* @author Sergey Malenkov28*/2930public final class Test4993777 extends AbstractTest {31public static void main(String[] args) {32new Test4993777().test(true);33}3435protected ArrayBean getObject() {36ArrayBean data = new ArrayBean();37data.setArray(38new InnerObject("one"),39new InnerObject("two")40);41return data;42}4344protected ArrayBean getAnotherObject() {45ArrayBean data = new ArrayBean();46data.setArray2D(47new InnerObject[] {48new InnerObject("1"),49new InnerObject("2"),50new InnerObject("3"),51},52new InnerObject[] {53new InnerObject("4"),54new InnerObject("5"),55new InnerObject("6"),56}57);58return data;59}6061public static final class ArrayBean {62private InnerObject[] array;63private InnerObject[][] array2D;6465public InnerObject[] getArray() {66return this.array;67}6869public void setArray(InnerObject... array) {70this.array = array;71}7273public InnerObject[][] getArray2D() {74return this.array2D;75}7677public void setArray2D(InnerObject[]... array2D) {78this.array2D = array2D;79}80}8182public static final class InnerObject {83private String name;8485public InnerObject() {86}8788private InnerObject(String name) {89this.name = name;90}9192public String getName() {93return this.name;94}9596public void setName(String name) {97this.name = name;98}99}100}101102103