1 22 package org.jboss.test.mx.mxbean.test; 23 24 import org.jboss.test.mx.mxbean.support.TestEnum; 25 26 import junit.framework.Test; 27 import junit.framework.TestSuite; 28 29 35 public class CompositeDataArrayUnitTestCase extends CompositeDataTest 36 { 37 public static Test suite() 38 { 39 return new TestSuite(CompositeDataArrayUnitTestCase.class); 40 } 41 42 public CompositeDataArrayUnitTestCase(String name) 43 { 44 super(name); 45 } 46 47 public void testArrayString() throws Exception 48 { 49 String [] array = { "one", "two", "three" }; 50 constructReconstructTest(array); 51 } 52 53 public void testMultiArrayString() throws Exception 54 { 55 String [][] array = { { "one", "two", "three" }, { "four", "five", "six" } }; 56 constructReconstructTest(array); 57 } 58 59 public void testArrayEnum() throws Exception 60 { 61 TestEnum[] array = { TestEnum.FIRST, TestEnum.SECOND }; 62 String [] openData = { TestEnum.FIRST.name(), TestEnum.SECOND.name() }; 63 constructReconstructTest(array, openData); 64 } 65 66 public void testMultiArrayEnum() throws Exception 67 { 68 TestEnum[][] array = { { TestEnum.FIRST, TestEnum.SECOND }, { TestEnum.SECOND } }; 69 String [][] openData = { { TestEnum.FIRST.name(), TestEnum.SECOND.name() }, { TestEnum.SECOND.name() } }; 70 constructReconstructTest(array, openData); 71 } 72 73 public void testArrayNull() throws Exception 74 { 75 constructReconstructTest(null, new String [0].getClass()); 76 } 77 78 public void testArrayElementNull() throws Exception 79 { 80 TestEnum[] array = { TestEnum.FIRST, null }; 81 String [] openData = { TestEnum.FIRST.name(), null }; 82 constructReconstructTest(array, openData); 83 } 84 85 public void testMultiArrayElementNull() throws Exception 86 { 87 TestEnum[][] array = { { TestEnum.FIRST, null }, { TestEnum.SECOND } }; 88 String [][] openData = { { TestEnum.FIRST.name(), null }, { TestEnum.SECOND.name() } }; 89 constructReconstructTest(array, openData); 90 } 91 92 public void testMultiArrayNull() throws Exception 93 { 94 TestEnum[][] array = { { TestEnum.FIRST, TestEnum.SECOND }, null, { TestEnum.SECOND } }; 95 String [][] openData = { { TestEnum.FIRST.name(), TestEnum.SECOND.name() }, null, { TestEnum.SECOND.name() } }; 96 constructReconstructTest(array, openData); 97 } 98 99 public void checkEquals(Object expected, Object actual) 100 { 101 checkArrayEquals(expected, actual); 102 } 103 } 104 | Popular Tags |