001    package jigcell.compare.tests;
002    
003    import java.lang.reflect.Method;
004    import java.util.AbstractMap;
005    import java.util.ArrayList;
006    import java.util.HashMap;
007    import java.util.TreeMap;
008    import jigcell.compare.IDataElement;
009    import jigcell.compare.data.DataElement;
010    import jigcell.compare.data.MethodDispatcher;
011    import jigcell.compare.data.PackedTreeDataElement;
012    import jigcell.compare.data.SparseTreeDataElement;
013    import jigcell.compare.impl.Compare;
014    import jigcell.compare.transform.ConstantTransform;
015    import jigcell.compare.transform.ITransform;
016    import jigcell.compare.transform.Transform;
017    import junit.framework.Test;
018    import junit.framework.TestCase;
019    import junit.framework.TestSuite;
020    import junit.textui.TestRunner;
021    
022    /**
023     * A collection of tests to exercise jigcell.compare.impl.MethodDispatcher.
024     *
025     * <p>
026     * This code is licensed under the DARPA BioCOMP Open Source License.  See LICENSE for more details.
027     * </p>
028     *
029     * @author Nicholas Allen
030     */
031    
032    public class MethodDispatcherTests extends TestCase {
033    
034       /**
035        * A test object
036        */
037    
038       protected final static Object object1 = new long [][] {{1, 2}, {3, 4}};
039    
040       /**
041        * A test object
042        */
043    
044       protected final static Object object2 = new double [][] {{1, 2}, {3, 4}};
045    
046       /**
047        * A test object
048        */
049    
050       protected final static Object object3 = new Object [] {new long [] {1, 2}, new double [] {1, 2}};
051    
052       /**
053        * A test object
054        */
055    
056       protected final static Object object4 = new Object [] {
057          new long [] {1, 2}, new double [] {1, 2}, "abc", new PackedTreeDataElement (), SparseTreeDataElement.createScalarElement (true),
058          new boolean [] {true, false}, new long [][] {{1}, {2, 3}}, null, Boolean.FALSE, DataElement.getLongObject (27)
059       };
060    
061       /**
062        * A test string
063        */
064    
065       protected final static String string1 = "((1, 2), (3, 4))";
066    
067       /**
068        * A test string
069        */
070    
071       protected final static String string2 = "((1.0, 2.0), (3.0, 4.0))";
072    
073       /**
074        * A test string
075        */
076    
077       protected final static String string3 = "((1, 2), (1.0, 2.0))";
078    
079       /**
080        * A test string
081        */
082    
083       protected final static String string4 = "((1, 2), (1.0, 2.0), \"abc\", No Value, true, (true, false), ((1), (2, 3)), No Value, false, 27)";
084    
085       /**
086        * Test transform for dispatching.
087        */
088    
089       public static class DispatchedTransform extends Transform {
090    
091          /**
092           * Method dispatcher for this transform
093           */
094    
095          protected MethodDispatcher dispatcher;
096    
097          /**
098           * Generates an instance.
099           */
100    
101          public static Object getCustomizableInstances () {
102             return new DispatchedTransform ();
103          }
104    
105          /**
106           * Creates a new dispatching transform.
107           */
108    
109          public DispatchedTransform () {
110             super ();
111             dispatcher = new MethodDispatcher (this, "customEvaluate");
112          }
113    
114          /**
115           * Evaluates the associated element.
116           */
117    
118          public double [] customEvaluate (double input []) {
119             return input;
120          }
121    
122          /**
123           * Evaluates the associated element.
124           */
125    
126          public long [] customEvaluate (long input [], long input2 []) {
127             return input;
128          }
129    
130          /**
131           * Evaluates the associated element.
132           */
133    
134          public double [] customEvaluate (double input [], double input2 []) {
135             return input;
136          }
137    
138          /**
139           * Evaluates the associated element.
140           */
141    
142          public double [][] customEvaluate (double input [][]) {
143             return input;
144          }
145    
146          /**
147           * Evaluates the associated element.
148           */
149    
150          public String [][] customEvaluate (String input [][]) {
151             return input;
152          }
153    
154          /**
155           * Evaluates the associated element.
156           */
157    
158          public IDataElement customEvaluate2 (IDataElement input) {
159             return input;
160          }
161    
162          /**
163           * Evaluates the associated element.
164           */
165    
166          public double customEvaluate2 (double input) {
167             return input;
168          }
169    
170          /**
171           * Evaluates the associated element.
172           */
173    
174          public long customEvaluate2 (long input) {
175             return input;
176          }
177    
178          /**
179           * Evaluates the associated element.
180           */
181    
182          public long [] customEvaluate2 (long input []) {
183             return input;
184          }
185    
186          /**
187           * Evaluates the associated element.
188           */
189    
190          public long [][] customEvaluate2 (long input [][]) {
191             return input;
192          }
193    
194          /**
195           * Sets the name of the dispatch method to use.
196           *
197           * @param name Name
198           */
199    
200          public void setMethodName (String name) {
201             dispatcher.setMethodName (name);
202          }
203    
204          /**
205           * Evaluates the associated element.
206           */
207    
208          protected IDataElement evaluate (IDataElement input) {
209             try {
210                return dispatcher.dispatch (input);
211             } catch (Exception e) {
212                Compare.assertion ("Error encountered during dispatch.", e);
213             }
214             return new SparseTreeDataElement ();
215          }
216       }
217    
218       /**
219        * Starts a new test suite run.
220        *
221        * @param args Program arguments
222        */
223    
224       public static void main (String args []) {
225          TestRunner.run (suite ());
226       }
227    
228       /**
229        * All of the tests in this test.
230        */
231    
232       public static Test suite () {
233          return new TestSuite (MethodDispatcherTests.class);
234       }
235    
236       /**
237        * Creates a new method dispatcher test.
238        *
239        * @param name Test name
240        */
241    
242       public MethodDispatcherTests (String name) {
243          super (name);
244       }
245    
246       /**
247        * Test for converting Long array to double array.
248        */
249    
250       public void testConvertArrayClassLongdouble () throws Exception {
251          Method converter = MethodDispatcher.class.getDeclaredMethod ("convertLongDouble", new Class [] {Long.class});
252          Object array = MethodDispatcher.convertArrayClass (new Long [] {DataElement.getLongObject (1)}, Double.TYPE, converter);
253          assertTrue (array instanceof double [] && ((double []) array) [0] == 1.0);
254       }
255    
256       /**
257        * Test for converting with null input.
258        */
259    
260       public void testConvertArrayClassNull () throws Exception {
261          Method converter = MethodDispatcher.class.getDeclaredMethod ("convertLongDouble", new Class [] {Long.class});
262          Object array = MethodDispatcher.convertArrayClass (null, Double.TYPE, converter);
263          assertTrue (array == null);
264       }
265    
266       /**
267        * Test for converting long array to Double array.
268        */
269    
270       public void testConvertArrayClasslongDouble () throws Exception {
271          Method converter = MethodDispatcher.class.getDeclaredMethod ("convertLongDouble", new Class [] {Long.class});
272          Object array = MethodDispatcher.convertArrayClass (new long [] {1}, Double.class, converter);
273          assertTrue (array instanceof Double [] && ((Double []) array) [0].doubleValue () == 1.0);
274       }
275    
276       /**
277        * Test for converting Long array to Double array.
278        */
279    
280       public void testConvertArrayClasslongdouble () throws Exception {
281          Method converter = MethodDispatcher.class.getDeclaredMethod ("convertLongDouble", new Class [] {Long.class});
282          Object array = MethodDispatcher.convertArrayClass (new long [] {1}, Double.TYPE, converter);
283          assertTrue (array instanceof double [] && ((double []) array) [0] == 1.0);
284       }
285    
286       /**
287        * Test for converting multidimensional long array to multidimensional double array.
288        */
289    
290       public void testConvertArrayClasslonglongdoubledouble () throws Exception {
291          Method converter = MethodDispatcher.class.getDeclaredMethod ("convertLongDouble", new Class [] {Long.class});
292          Object array = MethodDispatcher.convertArrayClass (new long [][] {{1, 2}, {3, 4}}, Double.TYPE, converter);
293          assertTrue (array instanceof double [][]);
294          double result [][] = (double [][]) array;
295          assertTrue (result.length == 2 && result [0].length == 2 && result [1].length == 2 && result [0] [0] == 1.0);
296       }
297    
298       /**
299        * Test for converting a time series of integers.
300        */
301    
302       public void testConvertFromElement1 () {
303          assertTrue (string1.equals (MethodDispatcher.convertToElement (MethodDispatcher.convertFromElement (MethodDispatcher.convertToElement (
304             object1))).toString ()));
305       }
306    
307       /**
308        * Test for converting a time series of reals.
309        */
310    
311       public void testConvertFromElement2 () {
312          assertTrue (string2.equals (MethodDispatcher.convertToElement (MethodDispatcher.convertFromElement (MethodDispatcher.convertToElement (
313             object2))).toString ()));
314       }
315    
316       /**
317        * Test for converting a time series of mixed longs and reals.
318        */
319    
320       public void testConvertFromElement3 () {
321          assertTrue (string3.equals (MethodDispatcher.convertToElement (MethodDispatcher.convertFromElement (MethodDispatcher.convertToElement (
322             object3))).toString ()));
323       }
324    
325       /**
326        * Test for converting a time series of mixed all types.
327        */
328    
329       public void testConvertFromElement4 () {
330          assertTrue (string4.equals (MethodDispatcher.convertToElement (MethodDispatcher.convertFromElement (MethodDispatcher.convertToElement (
331             object4))).toString ()));
332       }
333    
334       /**
335        * Test for converting integer zero to real.
336        */
337    
338       public void testConvertLongDouble0 () {
339          assertTrue (0.0 == MethodDispatcher.convertLongDouble (DataElement.getLongObject (0)).doubleValue ());
340       }
341    
342       /**
343        * Test for converting integer nonzero to real.
344        */
345    
346       public void testConvertLongDouble1 () {
347          assertTrue (1.0 == MethodDispatcher.convertLongDouble (DataElement.getLongObject (1)).doubleValue ());
348       }
349    
350       /**
351        * Test for converting null.
352        */
353    
354       public void testConvertLongDoubleEmpty () {
355          assertTrue (null == MethodDispatcher.convertLongDouble (null));
356       }
357    
358       /**
359        * Test for converting a time series of integers.
360        */
361    
362       public void testConvertToElement1 () {
363          assertTrue (string1.equals (MethodDispatcher.convertToElement (object1).toString ()));
364       }
365    
366       /**
367        * Test for converting a time series of reals.
368        */
369    
370       public void testConvertToElement2 () {
371          assertTrue (string2.equals (MethodDispatcher.convertToElement (object2).toString ()));
372       }
373    
374       /**
375        * Test for converting a time series of mixed longs and reals.
376        */
377    
378       public void testConvertToElement3 () {
379          assertTrue (string3.equals (MethodDispatcher.convertToElement (object3).toString ()));
380       }
381    
382       /**
383        * Test for converting a time series of mixed all types.
384        */
385    
386       public void testConvertToElement4 () {
387          assertTrue (string4.equals (MethodDispatcher.convertToElement (object4).toString ()));
388       }
389    
390       /**
391        * Test for creating a multidimensional boolean array class.
392        */
393    
394       public void testCreateArrayClassBoolean2 () {
395          assertTrue (boolean [][].class == MethodDispatcher.createArrayClass (Boolean.TYPE, 2));
396       }
397    
398       /**
399        * Test for creating a multidimensional character array class.
400        */
401    
402       public void testCreateArrayClassCharacter2 () {
403          assertTrue (char [][].class == MethodDispatcher.createArrayClass (Character.TYPE, 2));
404       }
405    
406       /**
407        * Test for creating a data element array class.
408        */
409    
410       public void testCreateArrayClassDataElement0 () {
411          assertTrue (IDataElement [].class == MethodDispatcher.createArrayClass (IDataElement [].class, 0));
412       }
413    
414       /**
415        * Test for creating a multidimensional data element array class from an array class.
416        */
417    
418       public void testCreateArrayClassDataElement1 () {
419          assertTrue (IDataElement [][].class == MethodDispatcher.createArrayClass (IDataElement [].class, 1));
420       }
421    
422       /**
423        * Test for creating a multidimensional data element array class from a base class.
424        */
425    
426       public void testCreateArrayClassDataElement2 () {
427          assertTrue (IDataElement [][].class == MethodDispatcher.createArrayClass (IDataElement.class, 2));
428       }
429    
430       /**
431        * Test for creating a multidimensional real array class.
432        */
433    
434       public void testCreateArrayClassDouble2 () {
435          assertTrue (double [][].class == MethodDispatcher.createArrayClass (Double.TYPE, 2));
436       }
437    
438       /**
439        * Test for creating a multidimensional real array class.
440        */
441    
442       public void testCreateArrayClassFloat2 () {
443          assertTrue (float [][].class == MethodDispatcher.createArrayClass (Float.TYPE, 2));
444       }
445    
446       /**
447        * Test for creating a multidimensional integral array class.
448        */
449    
450       public void testCreateArrayClassInteger2 () {
451          assertTrue (int [][].class == MethodDispatcher.createArrayClass (Integer.TYPE, 2));
452       }
453    
454       /**
455        * Test for creating a multidimensional integral array class.
456        */
457    
458       public void testCreateArrayClassLong2 () {
459          assertTrue (long [][].class == MethodDispatcher.createArrayClass (Long.TYPE, 2));
460       }
461    
462       /**
463        * Test for creating a large multidimensional array class.
464        */
465    
466       public void testCreateArrayClassLong5 () {
467          assertTrue (long [][][][][].class == MethodDispatcher.createArrayClass (Long.TYPE, 5));
468       }
469    
470       /**
471        * Test for creating a multidimensional integral array class.
472        */
473    
474       public void testCreateArrayClassShort2 () {
475          assertTrue (short [][].class == MethodDispatcher.createArrayClass (Short.TYPE, 2));
476       }
477    
478       /**
479        * Test for dispatching an integer list with conversion.
480        */
481    
482       public void testDispatch1 () {
483          ITransform t1 = new ConstantTransform (SparseTreeDataElement.createElement ("(1)"));
484          ITransform t2 = new DispatchedTransform ();
485          t2.setPreviousStatement (t1);
486          assertTrue ("(1.0)".equals (t2.getElement ().toString ()));
487       }
488    
489       /**
490        * Test for dispatching an integer list list with conversion.
491        */
492    
493       public void testDispatch2 () {
494          ITransform t1 = new ConstantTransform (SparseTreeDataElement.createElement ("((1))"));
495          ITransform t2 = new DispatchedTransform ();
496          t2.setPreviousStatement (t1);
497          assertTrue ("((1.0))".equals (t2.getElement ().toString ()));
498       }
499    
500       /**
501        * Test for dispatching string lists.
502        */
503    
504       public void testDispatch3 () {
505          ITransform t1 = new ConstantTransform (SparseTreeDataElement.createElement ("((\"1\"), (\"1\"))"));
506          ITransform t2 = new DispatchedTransform ();
507          t2.setPreviousStatement (t1);
508          assertTrue ("((\"1\"), (\"1\"))".equals (t2.getElement ().toString ()));
509       }
510    
511       /**
512        * Test for dispatching integer lists.
513        */
514    
515       public void testDispatch4 () {
516          ITransform t1 = new ConstantTransform (SparseTreeDataElement.createElement ("((1), (1))"));
517          ITransform t2 = new DispatchedTransform ();
518          t2.setPreviousStatement (t1);
519          assertTrue ("(1)".equals (t2.getElement ().toString ()));
520       }
521    
522       /**
523        * Test for dispatching an integer with no match.
524        */
525    
526       public void testDispatch5 () {
527          ITransform t1 = new ConstantTransform (SparseTreeDataElement.createElement ("1"));
528          ITransform t2 = new DispatchedTransform ();
529          t2.setPreviousStatement (t1);
530          assertTrue ("No Value".equals (t2.getElement ().toString ()));
531       }
532    
533       /**
534        * Test for dispatching real lists.
535        */
536    
537       public void testDispatch6 () {
538          ITransform t1 = new ConstantTransform (SparseTreeDataElement.createElement ("((1.0), (1.0))"));
539          ITransform t2 = new DispatchedTransform ();
540          t2.setPreviousStatement (t1);
541          assertTrue ("((1.0), (1.0))".equals (t2.getElement ().toString ()));
542       }
543    
544       /**
545        * Test for dispatching an integer with a custom method.
546        */
547    
548       public void testDispatch7 () {
549          ITransform t1 = new ConstantTransform (SparseTreeDataElement.createElement ("1"));
550          DispatchedTransform t2 = new DispatchedTransform ();
551          t2.setMethodName ("customEvaluate2");
552          t2.setPreviousStatement (t1);
553          assertTrue ("1".equals (t2.getElement ().toString ()));
554       }
555    
556       /**
557        * Test for dispatching an integer list with a custom method.
558        */
559    
560       public void testDispatch8 () {
561          ITransform t1 = new ConstantTransform (SparseTreeDataElement.createElement ("(1, 1)"));
562          DispatchedTransform t2 = new DispatchedTransform ();
563          t2.setMethodName ("customEvaluate2");
564          t2.setPreviousStatement (t1);
565          assertTrue ("(1, 1)".equals (t2.getElement ().toString ()));
566       }
567    
568       /**
569        * Test for dispatching integer lists with a custom method.
570        */
571    
572       public void testDispatch9 () {
573          ITransform t1 = new ConstantTransform (SparseTreeDataElement.createElement ("((1), (1))"));
574          DispatchedTransform t2 = new DispatchedTransform ();
575          t2.setMethodName ("customEvaluate2");
576          t2.setPreviousStatement (t1);
577          assertTrue ("((1), (1))".equals (t2.getElement ().toString ()));
578       }
579    
580       /**
581        * Test for finding superclass of one class.
582        */
583    
584       public void testFindCommonSuperclassArrayList () {
585          assertTrue (ArrayList.class == MethodDispatcher.findCommonSuperclass (new Object [] {new ArrayList ()}));
586       }
587    
588       /**
589        * Test for finding superclass of unrelated classes.
590        */
591    
592       public void testFindCommonSuperclassArrayListHashMap () {
593          assertTrue (Object.class == MethodDispatcher.findCommonSuperclass (new Object [] {new ArrayList (), new HashMap ()}));
594       }
595    
596       /**
597        * Test for finding superclass of one array class.
598        */
599    
600       public void testFindCommonSuperclassIntIntInt () {
601          assertTrue (int [][].class == MethodDispatcher.findCommonSuperclass (new int [1][2][3]));
602       }
603    
604       /**
605        * Test for finding superclass of mismatched array classes.
606        */
607    
608       public void testFindCommonSuperclassIntIntIntIntInt () {
609          assertTrue (Object.class == MethodDispatcher.findCommonSuperclass (new Object [] {new int [1][2][3], new int [1][2]}));
610       }
611    
612       /**
613        * Test for finding superclass of array classes.
614        */
615    
616       public void testFindCommonSuperclassIntIntIntIntIntInt () {
617          assertTrue (int [][][].class == MethodDispatcher.findCommonSuperclass (new Object [] {new int [1][2][3], new int [4][5][6]}));
618       }
619    
620       /**
621        * Test for finding superclass of related classes.
622        */
623    
624       public void testFindCommonSuperclassTreeMapHashMap () {
625          assertTrue (AbstractMap.class == MethodDispatcher.findCommonSuperclass (new Object [] {new TreeMap (), new HashMap ()}));
626       }
627    
628       /**
629        * Test for computing the dimensionality of a multidimensional data element array class.
630        */
631    
632       public void testGetDimensionDataElementDataElementDataElement () {
633          assertTrue (3 == MethodDispatcher.getDimension (IDataElement [][][].class));
634       }
635    
636       /**
637        * Test for computing the dimensionality of an array class.
638        */
639    
640       public void testGetDimensionInt () {
641          assertTrue (1 == MethodDispatcher.getDimension (int [].class));
642       }
643    
644       /**
645        * Test for computing the dimensionality of a null class.
646        */
647    
648       public void testGetDimensionNull () {
649          assertTrue (-1 == MethodDispatcher.getDimension (null));
650       }
651    
652       /**
653        * Test for computing the dimensionality of a non-array class.
654        */
655    
656       public void testGetDimensionVoid () {
657          assertTrue (0 == MethodDispatcher.getDimension (Void.class));
658       }
659    
660       /**
661        * Test for the underlying class of an array class.
662        */
663    
664       public void testGetUnderlyingClassBoolean () {
665          assertTrue (Boolean.TYPE == MethodDispatcher.getUnderlyingClass (boolean [].class));
666       }
667    
668       /**
669        * Test for the underlying class of a data element class.
670        */
671    
672       public void testGetUnderlyingClassDataElement () {
673          assertTrue (IDataElement.class == MethodDispatcher.getUnderlyingClass (IDataElement.class));
674       }
675    
676       /**
677        * Test for the underlying class of a multidimensional data element array class.
678        */
679    
680       public void testGetUnderlyingClassDataElementDataElementDataElement () {
681          assertTrue (IDataElement.class == MethodDispatcher.getUnderlyingClass (IDataElement [][][].class));
682       }
683    
684       /**
685        * Test for the underlying class of a primitive class.
686        */
687    
688       public void testGetUnderlyingClassDouble () {
689          assertTrue (Double.TYPE == MethodDispatcher.getUnderlyingClass (Double.TYPE));
690       }
691    
692       /**
693        * Test for the underlying class of a multidimensional primitive array class.
694        */
695    
696       public void testGetUnderlyingClassDoubleDouble () {
697          assertTrue (Double.TYPE == MethodDispatcher.getUnderlyingClass (double [][].class));
698       }
699    
700       /**
701        * Test for the underlying class of a null class.
702        */
703    
704       public void testGetUnderlyingClassEmpty () {
705          assertTrue (null == MethodDispatcher.getUnderlyingClass (null));
706       }
707    
708       /**
709        * Test for the underlying class of a multidimensional primitive array class.
710        */
711    
712       public void testGetUnderlyingClassFloatFloat () {
713          assertTrue (Float.TYPE == MethodDispatcher.getUnderlyingClass (float [][].class));
714       }
715    
716       /**
717        * Test for the underlying class of a multidimensional primitive array class.
718        */
719    
720       public void testGetUnderlyingClassIntegerIntegerInteger () {
721          assertTrue (Integer.TYPE == MethodDispatcher.getUnderlyingClass (int [][][].class));
722       }
723    
724       /**
725        * Test for the underlying class of a primitive class.
726        */
727    
728       public void testGetUnderlyingClassLong () {
729          assertTrue (Long.TYPE == MethodDispatcher.getUnderlyingClass (Long.TYPE));
730       }
731    
732       /**
733        * Test for the underlying class of a multidimensional primitive array class.
734        */
735    
736       public void testGetUnderlyingClassShortShort () {
737          assertTrue (Short.TYPE == MethodDispatcher.getUnderlyingClass (short [][].class));
738       }
739    
740       /**
741        * Test for the underlying class of an object class.
742        */
743    
744       public void testGetUnderlyingClassString () {
745          assertTrue (String.class == MethodDispatcher.getUnderlyingClass (String.class));
746       }
747    
748       /**
749        * Test for the underlying class of a multidimensional object array class.
750        */
751    
752       public void testGetUnderlyingClassStringString () {
753          assertTrue (String.class == MethodDispatcher.getUnderlyingClass (String [][].class));
754       }
755    
756       /**
757        * Test for checking convertibility of boolean primitive class.
758        */
759    
760       public void testIsConvertibleClassBoolean () {
761          assertTrue (MethodDispatcher.isConvertibleClass (Boolean.TYPE));
762       }
763    
764       /**
765        * Test for checking convertibility of data element class.
766        */
767    
768       public void testIsConvertibleClassDataElement () {
769          assertTrue (MethodDispatcher.isConvertibleClass (IDataElement.class));
770       }
771    
772       /**
773        * Test for checking convertibility of multidimensional data element array class.
774        */
775    
776       public void testIsConvertibleClassDataElementDataElement () {
777          assertTrue (MethodDispatcher.isConvertibleClass (IDataElement [][].class));
778       }
779    
780       /**
781        * Test for checking convertibility of double primitive class.
782        */
783    
784       public void testIsConvertibleClassDouble () {
785          assertTrue (MethodDispatcher.isConvertibleClass (Double.TYPE));
786       }
787    
788       /**
789        * Test for checking convertibility of multidimensional double primitive array class.
790        */
791    
792       public void testIsConvertibleClassDoubleDouble () {
793          assertTrue (MethodDispatcher.isConvertibleClass (double [][].class));
794       }
795    
796       /**
797        * Test for checking convertibility of null class.
798        */
799    
800       public void testIsConvertibleClassEmpty () {
801          assertFalse (MethodDispatcher.isConvertibleClass (null));
802       }
803    
804       /**
805        * Test for checking convertibility of long primitive class.
806        */
807    
808       public void testIsConvertibleClassLong () {
809          assertTrue (MethodDispatcher.isConvertibleClass (Long.TYPE));
810       }
811    
812       /**
813        * Test for checking convertibility of multidimensional long primitive array class.
814        */
815    
816       public void testIsConvertibleClassLongLong () {
817          assertTrue (MethodDispatcher.isConvertibleClass (long [][].class));
818       }
819    
820       /**
821        * Test for checking convertibility of multidimensional short primitive array class.
822        */
823    
824       public void testIsConvertibleClassShortShort () {
825          assertFalse (MethodDispatcher.isConvertibleClass (short [][].class));
826       }
827    
828       /**
829        * Test for checking convertibility of string object class.
830        */
831    
832       public void testIsConvertibleClassString () {
833          assertTrue (MethodDispatcher.isConvertibleClass (String.class));
834       }
835    
836       /**
837        * Test for checking convertibility of void primitive class.
838        */
839    
840       public void testIsConvertibleClassVoid () {
841          assertTrue (MethodDispatcher.isConvertibleClass (Void.TYPE));
842       }
843    }