1 7 package com.inversoft.util.test; 8 9 10 import java.util.ArrayList ; 11 import java.util.Collection ; 12 import java.util.HashMap ; 13 import java.util.HashSet ; 14 import java.util.List ; 15 import java.util.Map ; 16 17 import junit.framework.TestCase; 18 19 import com.inversoft.util.ObjectTools; 20 21 22 27 public class ObjectToolsTest extends TestCase { 28 29 public ObjectToolsTest(String name) { 30 super(name); 31 } 32 33 public void testQuick() { 34 Object obj1 = null; 35 String obj2 = null; 36 Object obj3 = helper(obj2); 37 38 assertTrue("Both null", obj3 == obj1); 39 } 40 41 public void testAreObjectsEqualStrings() { 42 43 String foo1 = new String ("foo"); 44 String foo2 = new String ("foo"); 45 String bar = new String ("bar"); 46 47 assertTrue("null, null should be equal", ObjectTools.areObjectsEqual(null, null)); 48 assertTrue("one string null should be false", !ObjectTools.areObjectsEqual(null, foo1)); 49 assertTrue("other string null should be false", !ObjectTools.areObjectsEqual(foo1, null)); 50 assertTrue("same object should be true", ObjectTools.areObjectsEqual(foo1, foo1)); 51 assertTrue("same string should be true", ObjectTools.areObjectsEqual(foo1, foo2)); 52 assertTrue("different strings should be false", !ObjectTools.areObjectsEqual(foo1, bar)); 53 } 54 55 public void testAreObjectsEqualStringsIntegers() { 56 57 String str1 = new String ("1"); 58 Integer int1 = new Integer (1); 59 Integer int11 = new Integer (1); 60 Integer int2 = new Integer (2); 61 62 String [] strings = {"1", "2", "3"}; 63 Integer [] ints = { new Integer (1), new Integer (2), new Integer (3) }; 64 65 assertTrue("Should be true, same", ObjectTools.areObjectsEqual(int1, int1)); 66 assertTrue("Should be true, equal", ObjectTools.areObjectsEqual(int1, int11)); 67 assertTrue("should be true, string == int", ObjectTools.areObjectsEqual(str1, int1)); 68 assertTrue("should be true, string == int again", ObjectTools.areObjectsEqual(int1, str1)); 69 70 assertTrue("should be false, string != int", !ObjectTools.areObjectsEqual(str1, int2)); 71 assertTrue("should be false, string != int again", !ObjectTools.areObjectsEqual(int2, str1)); 72 73 assertTrue("should be true, in array mix", ObjectTools.areObjectsEqual(int1, strings)); 74 assertTrue("should be true, in array mix again", ObjectTools.areObjectsEqual(strings, int2)); 75 assertTrue("should be true, in array remix", ObjectTools.areObjectsEqual(str1, ints)); 76 assertTrue("should be true, in array remix again", ObjectTools.areObjectsEqual(ints, str1)); 77 } 78 79 public void testAreObjectsEqualBeans() { 80 81 Bean bean1 = new Bean(); 82 Bean bean2 = new Bean(); 83 84 assertTrue("null, null should be equal", ObjectTools.areObjectsEqual(null, null)); 85 assertTrue("both getName() null should be true", ObjectTools.areObjectsEqual(bean1, bean2)); 86 87 bean1.setName("foo"); 88 assertTrue("one getName() null should be false", !ObjectTools.areObjectsEqual(bean1, bean2)); 89 90 bean2.setName("foo"); 91 assertTrue("both getName() 'foo' should be true", ObjectTools.areObjectsEqual(bean1, bean2)); 92 93 assertFalse(ObjectTools.areObjectsEqual(null, bean2)); 94 assertFalse(ObjectTools.areObjectsEqual(bean1, null)); 95 } 96 97 public void testAreObjectsEqualArrays() { 98 99 String [] strings = {"foo", "bar", "alpha", "beta"}; 100 String [] strings2 = {"foo", "bar", "alpha", "beta"}; 101 String value = "foo"; 102 String value2 = "alpha"; 103 104 assertTrue("Should be true, contains foo", ObjectTools.areObjectsEqual(value, strings)); 105 assertTrue("Should be true, contains foo", ObjectTools.areObjectsEqual(strings, value)); 106 assertTrue("Should be true, contains alpha", ObjectTools.areObjectsEqual(value2, strings)); 107 assertTrue("Should be true, contains alpha", ObjectTools.areObjectsEqual(strings, value2)); 108 109 assertTrue("Should be false, doesn't contain null", !ObjectTools.areObjectsEqual(null, strings)); 110 111 assertTrue("Should be true, cast to objects", ObjectTools.areObjectsEqual(helper(value), helper(strings))); 112 assertTrue("Should be true, for both arrays", ObjectTools.areObjectsEqual(strings2, strings)); 113 114 strings[2] = null; 115 assertTrue("Should be false, one is null and other is not", !ObjectTools.areObjectsEqual(null, strings)); 116 } 117 118 public void testAreObjectsEqualObjectArrays() { 119 120 Bean [] beans = { new Bean("foo"), new Bean("bar"), new Bean("alpha"), new Bean("beta") }; 121 Bean [] beans2 = { new Bean("foo"), new Bean("bar"), new Bean("alpha"), new Bean("beta") }; 122 Bean [] beans3 = { new Bean("1"), new Bean("2"), new Bean("3"), new Bean("4") }; 123 Bean [] beans4 = { new Bean(), new Bean(), new Bean(), new Bean() }; 124 String value = "foo"; 125 String value2 = "alpha"; 126 127 assertTrue("Should be true, same array", ObjectTools.areObjectsEqual(beans, beans2)); 128 assertTrue("Should be false, not same array", !ObjectTools.areObjectsEqual(beans, beans3)); 129 assertTrue("Should be false, not same array", !ObjectTools.areObjectsEqual(beans, beans4)); 130 assertTrue("Should be true, contains foo", ObjectTools.areObjectsEqual(beans, value)); 131 assertTrue("Should be true, contains foo", ObjectTools.areObjectsEqual(value, beans)); 132 assertTrue("Should be true, contains alpha", ObjectTools.areObjectsEqual(beans, value2)); 133 134 assertTrue("Should be true, contains object", ObjectTools.areObjectsEqual(beans, beans[1])); 135 assertTrue("Should be true, contains object again", ObjectTools.areObjectsEqual(beans, beans2[1])); 136 } 137 138 public void testAreObjectsEqualCollection() { 139 140 String value = "foo"; 141 Collection list = new ArrayList (); 142 list.add(value); list.add("bar"); list.add("alpha"); list.add("beta"); 143 Collection list2 = new ArrayList (); 144 list2.add("foo"); list2.add("bar"); list2.add("alpha"); list2.add("beta"); 145 Collection list3 = new ArrayList (); 146 list3.add("1"); list3.add("2"); list3.add("3"); list3.add("4"); 147 Collection list4 = new ArrayList (); 148 list4.add("1"); list4.add("2"); list4.add("3"); 149 150 assertTrue("Should be true, same collection", ObjectTools.areObjectsEqual(list, list2)); 151 assertTrue("Should be false, not same collection", !ObjectTools.areObjectsEqual(list, list3)); 152 assertTrue("Should be false, collection sizes", !ObjectTools.areObjectsEqual(list4, list3)); 153 assertTrue("Should be true, object in collection", ObjectTools.areObjectsEqual(value, list)); 154 assertTrue("Should be true, object in collection", ObjectTools.areObjectsEqual(list, value)); 155 assertTrue("Should be true, object identical to one in collection", ObjectTools.areObjectsEqual(value, list2)); 156 } 157 158 public void testAreObjectsEqualObjectCollection() { 159 160 Bean bean1 = new Bean("foo"); 161 Collection list = new ArrayList (); 162 list.add(bean1); list.add(new Bean("bar")); list.add(new Bean("alpha")); list.add(new Bean("beta")); 163 Collection list2 = new ArrayList (); 164 list2.add(new Bean("foo")); list2.add(new Bean("bar")); list2.add(new Bean("alpha")); list2.add(new Bean("beta")); 165 Collection list3 = new ArrayList (); 166 list3.add(new Bean("1")); list3.add(new Bean("2")); list3.add(new Bean("3")); list3.add(new Bean("4")); 167 Collection list4 = new ArrayList (); 168 list4.add(new Bean("1")); list4.add(new Bean("2")); list4.add(new Bean("3")); 169 String value = "foo"; 170 String value2 = "alpha"; 171 172 assertTrue("Should be true, same collection", ObjectTools.areObjectsEqual(list, list2)); 173 assertTrue("Should be false, not same collection", !ObjectTools.areObjectsEqual(list, list3)); 174 assertTrue("Should be false, collection sizes", !ObjectTools.areObjectsEqual(list4, list3)); 175 assertTrue("Should be true, object in collection", ObjectTools.areObjectsEqual(bean1, list)); 176 assertTrue("Should be true, object in collection", ObjectTools.areObjectsEqual(list, bean1)); 177 assertTrue("Should be true, object identical to one in collection", ObjectTools.areObjectsEqual(bean1, list2)); 178 assertTrue("Should be true, contains foo", ObjectTools.areObjectsEqual(list, value)); 179 assertTrue("Should be true, contains alpha", ObjectTools.areObjectsEqual(list, value2)); 180 } 181 182 186 public void testAreObjectsEqualCollectionArray() { 187 188 Collection list = new ArrayList (); 189 list.add("foo"); list.add("bar"); list.add("alpha"); list.add("beta"); 190 String [] strings = {"foo", "bar", "alpha", "beta"}; 191 String [] strings2 = {"foo2", "bar", "alpha", "beta"}; 192 193 assertTrue("Should be true, same values", ObjectTools.areObjectsEqual(list, strings)); 194 assertTrue("Should be false, not same values", !ObjectTools.areObjectsEqual(list, strings2)); 195 assertTrue("Should be true, same values", ObjectTools.areObjectsEqual(strings, list)); 196 assertTrue("Should be false, not same values", !ObjectTools.areObjectsEqual(strings2, list)); 197 } 198 199 203 public void testAreObjectsEqualCollectionArrayObjects() { 204 205 Collection list = new ArrayList (); 206 list.add(new Bean("foo")); 207 list.add(new Bean("bar")); 208 list.add(new Bean("alpha")); 209 list.add(new Bean("beta")); 210 Bean [] beans = { new Bean("foo"), new Bean("bar"), new Bean("alpha"), new Bean("beta") }; 211 Bean [] beans2 = { new Bean("foo2"), new Bean("bar"), new Bean("alpha"), new Bean("beta") }; 212 213 assertTrue("Should be true, same values", ObjectTools.areObjectsEqual(list, beans)); 214 assertTrue("Should be false, not same values", !ObjectTools.areObjectsEqual(list, beans2)); 215 assertTrue("Should be true, same values", ObjectTools.areObjectsEqual(beans, list)); 216 assertTrue("Should be false, not same values", !ObjectTools.areObjectsEqual(beans2, list)); 217 } 218 219 222 public void testArrayContains() { 223 224 Bean [] beans = { new Bean("foo"), null, new Bean("bar"), 225 new Bean("alpha"), new Bean("beta") }; 226 Bean bean = new Bean("alpha"); 227 String value = "beta"; 228 String value2 = "foo"; 229 230 assertTrue(ObjectTools.arrayContains(beans, bean)); 231 assertTrue(ObjectTools.arrayContains(beans, value)); 232 assertTrue(ObjectTools.arrayContains(beans, value2)); 233 assertTrue(ObjectTools.arrayContains(beans, beans)); 234 assertFalse(ObjectTools.arrayContains(beans, null)); 235 assertFalse(ObjectTools.arrayContains(null, value)); 236 } 237 238 241 public void testArrayContainsString() { 242 243 Bean [] beans = { new Bean("foo"), null, new Bean("bar"), 244 new Bean("alpha"), new Bean("beta") }; 245 String value = "beta"; 246 String value2 = "foo"; 247 String value3 = "outside"; 248 249 assertTrue(ObjectTools.arrayContainsString(beans, value)); 250 assertTrue(ObjectTools.arrayContainsString(beans, value2)); 251 assertFalse(ObjectTools.arrayContainsString(beans, null)); 252 assertFalse(ObjectTools.arrayContainsString(null, value)); 253 assertTrue(ObjectTools.arrayContainsString(null, null)); 254 assertFalse(ObjectTools.arrayContainsString(beans, value3)); 255 } 256 257 260 public void testCleanString() { 261 String foo = "foo"; 262 assertSame(foo, ObjectTools.cleanToString(foo)); 263 assertSame("", ObjectTools.cleanToString(null)); 264 } 265 266 269 public void testToString() { 270 assertEquals("foo", ObjectTools.toString("foo")); 271 assertNull(ObjectTools.toString(null)); 272 } 273 274 277 public void testWrapArray() { 278 279 byte[] bytes = new byte[] {1, 2, 3, 4}; 280 short[] shorts = new short[] {1, 2, 3, 4}; 281 int[] ints = new int[] {1, 2, 3, 4}; 282 long[] longs = new long[] {1, 2, 3, 4}; 283 float[] floats = new float[] {1, 2, 3, 4}; 284 double[] doubs = new double[] {1, 2, 3, 4}; 285 286 Number [] wrappers = ObjectTools.wrapArray(bytes); 287 assertTrue(wrappers instanceof Byte []); 288 assertEquals(4, wrappers.length); 289 for (int i = 0; i < wrappers.length; i++) { 290 assertEquals(i + 1, wrappers[i].intValue()); 291 } 292 293 wrappers = ObjectTools.wrapArray(shorts); 294 assertTrue(wrappers instanceof Short []); 295 assertEquals(4, wrappers.length); 296 for (int i = 0; i < wrappers.length; i++) { 297 assertEquals(i + 1, wrappers[i].intValue()); 298 } 299 300 wrappers = ObjectTools.wrapArray(ints); 301 assertTrue(wrappers instanceof Integer []); 302 assertEquals(4, wrappers.length); 303 for (int i = 0; i < wrappers.length; i++) { 304 assertEquals(i + 1, wrappers[i].intValue()); 305 } 306 307 wrappers = ObjectTools.wrapArray(longs); 308 assertTrue(wrappers instanceof Long []); 309 assertEquals(4, wrappers.length); 310 for (int i = 0; i < wrappers.length; i++) { 311 assertEquals(i + 1, wrappers[i].intValue()); 312 } 313 314 wrappers = ObjectTools.wrapArray(floats); 315 assertTrue(wrappers instanceof Float []); 316 assertEquals(4, wrappers.length); 317 for (int i = 0; i < wrappers.length; i++) { 318 assertEquals(i + 1, wrappers[i].intValue()); 319 } 320 321 wrappers = ObjectTools.wrapArray(doubs); 322 assertTrue(wrappers instanceof Double []); 323 assertEquals(4, wrappers.length); 324 for (int i = 0; i < wrappers.length; i++) { 325 assertEquals(i + 1, wrappers[i].intValue()); 326 } 327 328 wrappers = ObjectTools.wrapArray("foo"); 329 assertNull(wrappers); 330 } 331 332 335 public void testGetFromCollectionMap() { 336 Map map = new HashMap (); 337 map.put("key", "value"); 338 339 Object value = ObjectTools.getValueFromCollection(map, "key"); 340 assertEquals("value", value); 341 value = ObjectTools.getValueFromCollection(map, "badKey"); 342 assertNull(value); 343 } 344 345 348 public void testGetFromCollectionList() { 349 List list = new ArrayList (); 350 list.add("key"); 351 list.add("value"); 352 353 Object value = ObjectTools.getValueFromCollection(list, new Integer (1)); 354 assertEquals("value", value); 355 value = ObjectTools.getValueFromCollection(list, new Integer (0)); 356 assertEquals("key", value); 357 try { 358 ObjectTools.getValueFromCollection(list, new Integer (2)); 359 fail("Should have failed"); 360 } catch (IndexOutOfBoundsException ioobe) { 361 } 363 try { 364 ObjectTools.getValueFromCollection(list, "key"); 365 fail("Should have failed"); 366 } catch (IllegalArgumentException iae) { 367 } 369 } 370 371 374 public void testGetFromCollectionCollection() { 375 Collection collection = new HashSet (); 376 collection.add("key"); 377 collection.add("value"); 378 379 Object value = ObjectTools.getValueFromCollection(collection, new Integer (1)); 380 assertEquals("value", value); 381 value = ObjectTools.getValueFromCollection(collection, new Integer (0)); 382 assertEquals("key", value); 383 try { 384 ObjectTools.getValueFromCollection(collection, new Integer (2)); 385 fail("Should have failed"); 386 } catch (IndexOutOfBoundsException ioobe) { 387 } 389 try { 390 ObjectTools.getValueFromCollection(collection, "key"); 391 fail("Should have failed"); 392 } catch (IllegalArgumentException iae) { 393 } 395 } 396 397 400 public void testGetFromCollectionArray() { 401 Object [] array = new Object [2]; 402 array[0] = "key"; 403 array[1] = "value"; 404 405 Object value = ObjectTools.getValueFromCollection(array, new Integer (1)); 406 assertEquals("value", value); 407 value = ObjectTools.getValueFromCollection(array, new Integer (0)); 408 assertEquals("key", value); 409 try { 410 ObjectTools.getValueFromCollection(array, new Integer (2)); 411 fail("Should have failed"); 412 } catch (IndexOutOfBoundsException ioobe) { 413 } 415 try { 416 ObjectTools.getValueFromCollection(array, "key"); 417 fail("Should have failed"); 418 } catch (IllegalArgumentException iae) { 419 } 421 } 422 423 426 public void testGetFromCollection() { 427 Object obj = "foo"; 428 429 try { 430 ObjectTools.getValueFromCollection(obj, new Integer (0)); 431 fail("Should have failed"); 432 } catch (IllegalArgumentException iae) { 433 } 434 try { 435 ObjectTools.getValueFromCollection(obj, "key"); 436 fail("Should have failed"); 437 } catch (IllegalArgumentException iae) { 438 } 439 try { 440 ObjectTools.getValueFromCollection(obj, null); 441 fail("Should have failed"); 442 } catch (IllegalArgumentException iae) { 443 } 444 } 445 446 449 public void testSetValueIntoArray() { 450 Boolean bo = Boolean.TRUE; 451 Byte b = new Byte ((byte) 0); 452 Character c = new Character ('a'); 453 Short s = new Short ((short) 1); 454 Integer i = new Integer (2); 455 Long l = new Long (3); 456 Float f = new Float (4); 457 Double d = new Double (5); 458 459 boolean[] boa = new boolean[3]; 460 boa[1] = false; 461 ObjectTools.setIntoArray(boa, 1, bo); 462 assertEquals(true, boa[1]); 463 464 byte[] ba = new byte[3]; 465 ba[1] = 1; 466 ObjectTools.setIntoArray(ba, 1, b); 467 assertEquals(0, ba[1]); 468 469 char[] ca = new char[3]; 470 ca[1] = 'S'; 471 ObjectTools.setIntoArray(ca, 1, c); 472 assertEquals('a', ca[1]); 473 474 short[] sa = new short[3]; 475 sa[1] = 0; 476 ObjectTools.setIntoArray(sa, 1, s); 477 assertEquals(1, sa[1]); 478 479 int[] ia = new int[3]; 480 ia[1] = 0; 481 ObjectTools.setIntoArray(ia, 1, i); 482 assertEquals(2, ia[1]); 483 484 long[] la = new long[3]; 485 la[1] = 0; 486 ObjectTools.setIntoArray(la, 1, l); 487 assertEquals(3, la[1]); 488 489 float[] fa = new float[3]; 490 fa[1] = 0; 491 ObjectTools.setIntoArray(fa, 1, f); 492 assertEquals(4f, fa[1], 0); 493 494 double[] da = new double[3]; 495 da[1] = 0; 496 ObjectTools.setIntoArray(da, 1, d); 497 assertEquals(5, da[1], 0); 498 499 try { 500 ObjectTools.setIntoArray("foo", 0, "bar"); 501 fail("Should have failed"); 502 } catch (IllegalArgumentException iae) { 503 } 505 506 Object [] oa = new Object [3]; 507 oa[1] = null; 508 ObjectTools.setIntoArray(oa, 1, "foo"); 509 assertSame("foo", oa[1]); 510 } 511 512 515 public void testSetValueIntoCollection() { 516 Map map = new HashMap (); 517 ObjectTools.setValueIntoCollection(map, "key", "value"); 518 assertEquals("value", map.get("key")); 519 520 List list = new ArrayList (10); 521 for (int i = 0; i < 10; i++) { 522 list.add(""); 523 } 524 ObjectTools.setValueIntoCollection(list, new Integer (4), "value"); 525 assertEquals("value", list.get(4)); 526 try { 527 ObjectTools.setValueIntoCollection(list, "key", "value"); 528 fail("Should have failed"); 529 } catch (IllegalArgumentException iae) { 530 } 532 533 Object [] array = new Object [10]; 534 ObjectTools.setValueIntoCollection(array, new Integer (4), "value"); 535 assertEquals("value", array[4]); 536 537 try { 538 ObjectTools.setValueIntoCollection(new HashSet (), new Integer (4), 539 "value"); 540 fail("Should have failed"); 541 } catch (IllegalArgumentException iae) { 542 } 544 try { 545 ObjectTools.setValueIntoCollection("foo", new Integer (4), "value"); 546 fail("Should have failed"); 547 } catch (IllegalArgumentException iae) { 548 } 550 } 551 552 555 public void testIsCollection() { 556 Map map = new HashMap (); 557 List list = new ArrayList (); 558 Collection set = new HashSet (); 559 560 assertTrue(ObjectTools.isCollection(map)); 561 assertTrue(ObjectTools.isCollection(list)); 562 assertTrue(ObjectTools.isCollection(set)); 563 assertFalse(ObjectTools.isCollection("foo")); 564 assertFalse(ObjectTools.isCollection(new Object [2])); 565 assertFalse(ObjectTools.isCollection((Object ) null)); 566 567 assertTrue(ObjectTools.isCollection(HashMap .class)); 568 assertTrue(ObjectTools.isCollection(ArrayList .class)); 569 assertTrue(ObjectTools.isCollection(HashSet .class)); 570 assertFalse(ObjectTools.isCollection(String .class)); 571 assertFalse(ObjectTools.isCollection(Object [].class)); 572 } 573 574 public void testIsArray() { 575 assertTrue(ObjectTools.isArray(new Object [0])); 576 assertTrue(ObjectTools.isArray(new int[0])); 577 assertFalse(ObjectTools.isArray(new Object ())); 578 assertFalse(ObjectTools.isArray(null)); 579 } 580 581 public void testIsDataStructure() { 582 Map map = new HashMap (); 583 List list = new ArrayList (); 584 Collection set = new HashSet (); 585 586 assertTrue(ObjectTools.isDataStructure(map)); 587 assertTrue(ObjectTools.isDataStructure(list)); 588 assertTrue(ObjectTools.isDataStructure(set)); 589 assertTrue(ObjectTools.isDataStructure(new Object [2])); 590 assertFalse(ObjectTools.isDataStructure("foo")); 591 assertFalse(ObjectTools.isDataStructure(null)); 592 593 assertTrue(ObjectTools.isDataStructure(new Object [0])); 594 assertTrue(ObjectTools.isDataStructure(new int[0])); 595 assertFalse(ObjectTools.isDataStructure(new Object ())); 596 assertFalse(ObjectTools.isDataStructure(null)); 597 } 598 599 public void testCreateArray() { 600 List indices = new ArrayList (); 601 indices.add(new Integer (3)); 602 indices.add(new Integer (7)); 603 indices.add(new Integer (11)); 604 ObjectTools.ArrayInfo ai = ObjectTools.createArray(String [][][].class, 605 indices, 0); 606 assertEquals(4, ((Object [][][]) ai.array).length); 607 assertEquals(8, ((Object [][][]) ai.array)[0].length); 608 assertEquals(12, ((Object [][][]) ai.array)[0][0].length); 609 assertTrue(ai.complete); 610 } 611 612 public void testCreateArrayStart() { 613 List indices = new ArrayList (); 614 indices.add(new Integer (3)); 615 indices.add(new Integer (7)); 616 indices.add(new Integer (11)); 617 ObjectTools.ArrayInfo ai = ObjectTools.createArray(String [][][].class, 618 indices, 1); 619 assertEquals(8, ((Object [][][]) ai.array).length); 620 assertEquals(12, ((Object [][][]) ai.array)[0].length); 621 assertNull(((Object [][][]) ai.array)[0][0]); 622 assertFalse(ai.complete); 623 } 624 625 public void testCreateArrayTooManyIndices() { 626 List indices = new ArrayList (); 627 indices.add(new Integer (3)); 628 indices.add(new Integer (7)); 629 indices.add(new Integer (2)); 630 indices.add(new Integer (3)); 631 indices.add(new Integer (1)); 632 ObjectTools.ArrayInfo ai = ObjectTools.createArray(String [][][].class, 633 indices, 0); 634 assertEquals(String [][][].class, ai.array.getClass()); 635 assertEquals(4, ((Object [][][]) ai.array).length); 636 assertEquals(8, ((Object [][][]) ai.array)[0].length); 637 assertEquals(3, ((Object [][][]) ai.array)[0][0].length); 638 assertNull(((Object [][][]) ai.array)[0][0][0]); 639 assertFalse(ai.complete); 640 } 641 642 private Object helper(Object obj1) { 643 return obj1; 644 } 645 } | Popular Tags |