@@ -329,12 +329,12 @@ public void testIsApplicableRaw() {
329329 // f(Double, Integer)
330330 // [OK] Double -> Number
331331 final Type [] srcOK = { Double .class , Integer .class };
332- assertEquals (Types .isApplicable (srcOK , dest ), - 1 );
332+ assertEquals (- 1 , Types .isApplicable (srcOK , dest ));
333333
334334 // f(String, Integer)
335335 // [MISS] String is not assignable to Number
336336 final Type [] srcMiss = { String .class , Integer .class };
337- assertNotEquals (Types .isApplicable (srcMiss , dest ), - 1 );
337+ assertNotEquals (- 1 , Types .isApplicable (srcMiss , dest ));
338338
339339 }
340340
@@ -346,12 +346,12 @@ public <T extends Number, U extends BigInteger> void testIsApplicableSingle() {
346346 final Type u = new Nil <U >() {}.type ();
347347 final Type [] tDest = { t };
348348
349- assertEquals (Types .isApplicable (new Type [] { Double .class }, tDest ), - 1 );
350- assertEquals (Types .isApplicable (new Type [] { Number .class }, tDest ), - 1 );
351- assertEquals (Types .isApplicable (new Type [] { t }, tDest ), - 1 );
352- assertEquals (Types .isApplicable (new Type [] { u }, tDest ), - 1 );
349+ assertEquals (- 1 , Types .isApplicable (new Type [] { Double .class }, tDest ));
350+ assertEquals (- 1 , Types .isApplicable (new Type [] { Number .class }, tDest ));
351+ assertEquals (- 1 , Types .isApplicable (new Type [] { t }, tDest ));
352+ assertEquals (- 1 , Types .isApplicable (new Type [] { u }, tDest ));
353353 // String does not extend Number
354- assertNotEquals (Types .isApplicable (new Type [] { String .class }, tDest ), - 1 );
354+ assertNotEquals (- 1 , Types .isApplicable (new Type [] { String .class }, tDest ));
355355
356356 // -SINGLY RECURSIVE CALLS-
357357
@@ -372,19 +372,18 @@ public <T extends Number, U extends BigInteger> void testIsApplicableSingle() {
372372 .type ();
373373 final Type [] listExtendsNumberDest = { listExtendsNumber };
374374
375- assertEquals (Types .isApplicable (new Type [] { listT }, listTDest ), - 1 );
376- assertEquals (Types .isApplicable (listUDest , listTDest ), - 1 );
375+ assertEquals (- 1 , Types .isApplicable (new Type [] { listT }, listTDest ));
376+ assertEquals (- 1 , Types .isApplicable (listUDest , listTDest ));
377377 // not all Numbers are BigIntegers.
378- assertNotEquals (Types .isApplicable (listTDest , listUDest ), - 1 );
379- assertEquals (Types .isApplicable (listTDest , listExtendsNumberDest ), - 1 );
380- assertEquals (Types .isApplicable (listUDest , listExtendsNumberDest ), - 1 );
381- assertEquals (Types .isApplicable (listTDest , listSuperNumberDest ), - 1 );
378+ assertNotEquals (- 1 , Types .isApplicable (listTDest , listUDest ));
379+ assertEquals (- 1 , Types .isApplicable (listTDest , listExtendsNumberDest ));
380+ assertEquals (- 1 , Types .isApplicable (listUDest , listExtendsNumberDest ));
381+ assertEquals (- 1 , Types .isApplicable (listTDest , listSuperNumberDest ));
382382 // BigInteger extends Number, not the other way around.
383- assertNotEquals (Types .isApplicable (listUDest , listSuperNumberDest ), - 1 );
384- assertEquals (Types .isApplicable (listDoubleDest , listExtendsNumberDest ), - 1 );
383+ assertNotEquals (- 1 , Types .isApplicable (listUDest , listSuperNumberDest ));
384+ assertEquals (- 1 , Types .isApplicable (listDoubleDest , listExtendsNumberDest ));
385385 // Double extends Number, not the other way around.
386- assertNotEquals (Types .isApplicable (listDoubleDest , listSuperNumberDest ),
387- -1 );
386+ assertNotEquals (-1 , Types .isApplicable (listDoubleDest , listSuperNumberDest ));
388387
389388 // -MULTIPLY RECURSIVE CALLS-
390389
@@ -402,32 +401,32 @@ public <T extends Number, U extends BigInteger> void testIsApplicableSingle() {
402401 .type ();
403402
404403 // T might not always extend BigInteger(U)
405- assertNotEquals (Types .isApplicable (new Type [] { MapListTT }, new Type [] {
406- MapListTU }), - 1 );
404+ assertNotEquals (- 1 , Types .isApplicable (new Type [] { MapListTT }, new Type [] {
405+ MapListTU }));
407406 // T might not always be the same as U
408- assertNotEquals (Types .isApplicable (new Type [] { MapListTU }, new Type [] {
409- MapListTT }), - 1 );
410- assertEquals (Types .isApplicable (new Type [] { MapListUU }, new Type [] {
411- MapListTT }), - 1 );
407+ assertNotEquals (- 1 , Types .isApplicable (new Type [] { MapListTU }, new Type [] {
408+ MapListTT }));
409+ assertEquals (- 1 , Types .isApplicable (new Type [] { MapListUU }, new Type [] {
410+ MapListTT }));
412411 // T might not always extend BigInteger(U)
413- assertNotEquals (Types .isApplicable (new Type [] { MapListTT }, new Type [] {
414- MapListUU }), - 1 );
412+ assertNotEquals (- 1 , Types .isApplicable (new Type [] { MapListTT }, new Type [] {
413+ MapListUU }));
415414 // T might not always be Double
416- assertNotEquals (Types .isApplicable (new Type [] { MapListTDouble },
417- new Type [] { MapListTT }), - 1 );
415+ assertNotEquals (- 1 , Types .isApplicable (new Type [] { MapListTDouble },
416+ new Type [] { MapListTT }));
418417 // T does not extend String.
419- assertNotEquals (Types .isApplicable (new Type [] { MapListDoubleString },
420- new Type [] { MapListTT }), - 1 );
421- assertEquals (Types .isApplicable (new Type [] { MapListDoubleDouble },
422- new Type [] { MapListTT }), - 1 );
418+ assertNotEquals (- 1 , Types .isApplicable (new Type [] { MapListDoubleString },
419+ new Type [] { MapListTT }));
420+ assertEquals (- 1 , Types .isApplicable (new Type [] { MapListDoubleDouble },
421+ new Type [] { MapListTT }));
423422 // T is already fixed to Double (in a parameterized Map), cannot accommodate
424423 // Number.
425- assertNotEquals (Types .isApplicable (new Type [] { MapListNumberDouble },
426- new Type [] { MapListTT }), - 1 );
424+ assertNotEquals (- 1 , Types .isApplicable (new Type [] { MapListNumberDouble },
425+ new Type [] { MapListTT }));
427426 // T is already fixed to Double (in a parameterized List) , cannot
428427 // accommodate Number
429- assertNotEquals (Types .isApplicable (new Type [] { MapListDoubleNumber },
430- new Type [] { MapListTT }), - 1 );
428+ assertNotEquals (- 1 , Types .isApplicable (new Type [] { MapListDoubleNumber },
429+ new Type [] { MapListTT }));
431430 }
432431
433432 @ Test
@@ -440,48 +439,48 @@ public <T extends Number, U extends BigInteger> void testIsApplicableSingle() {
440439 final Type arrayV = new Nil <V []>() {}.type ();
441440 final Type arrayDouble = new Nil <Double []>() {}.type ();
442441
443- assertEquals (Types .isApplicable (new Type [] { arrayDouble }, new Type [] {
444- arrayT }), - 1 );
442+ assertEquals (- 1 , Types .isApplicable (new Type [] { arrayDouble }, new Type [] {
443+ arrayT }));
445444 // Double does not extend String
446- assertNotEquals (Types .isApplicable (new Type [] { arrayDouble }, new Type [] {
447- arrayU }), - 1 );
448- assertEquals (Types .isApplicable (new Type [] { arrayT }, new Type [] {
449- arrayT }), - 1 );
450- assertEquals (Types .isApplicable (new Type [] { arrayV }, new Type [] {
451- arrayT }), - 1 );
445+ assertNotEquals (- 1 , Types .isApplicable (new Type [] { arrayDouble }, new Type [] {
446+ arrayU }));
447+ assertEquals (- 1 , Types .isApplicable (new Type [] { arrayT }, new Type [] {
448+ arrayT }));
449+ assertEquals (- 1 , Types .isApplicable (new Type [] { arrayV }, new Type [] {
450+ arrayT }));
452451 // Number does not extend BigInteger
453- assertNotEquals (Types .isApplicable (new Type [] { arrayT }, new Type [] {
454- arrayV }), - 1 );
452+ assertNotEquals (- 1 , Types .isApplicable (new Type [] { arrayT }, new Type [] {
453+ arrayV }));
455454
456455 // generic multi-dimensional arrays
457456 final Type arrayT2D = new Nil <T [][]>() {}.type ();
458457 final Type arrayV2D = new Nil <V [][]>() {}.type ();
459458 final Type arrayDouble2D = new Nil <Double [][]>() {}.type ();
460459
461- assertEquals (Types .isApplicable (new Type [] { arrayDouble2D }, new Type [] {
462- arrayT2D }), - 1 );
463- assertEquals (Types .isApplicable (new Type [] { arrayV2D }, new Type [] {
464- arrayT2D }), - 1 );
460+ assertEquals (- 1 , Types .isApplicable (new Type [] { arrayDouble2D }, new Type [] {
461+ arrayT2D }));
462+ assertEquals (- 1 , Types .isApplicable (new Type [] { arrayV2D }, new Type [] {
463+ arrayT2D }));
465464 // A 2D array does not satisfy a 1D array
466- assertNotEquals (Types .isApplicable (new Type [] { arrayT2D }, new Type [] {
467- arrayT }), - 1 );
465+ assertNotEquals (- 1 , Types .isApplicable (new Type [] { arrayT2D }, new Type [] {
466+ arrayT }));
468467 // A 1D array does not satisfy a 2D array
469- assertNotEquals (Types .isApplicable (new Type [] { arrayT }, new Type [] {
470- arrayT2D }), - 1 );
468+ assertNotEquals (- 1 , Types .isApplicable (new Type [] { arrayT }, new Type [] {
469+ arrayT2D }));
471470
472471 // generic parameterized type arrays
473472 final Type arrayListT = new Nil <List <T >[]>() {}.type ();
474473 final Type arrayListDouble = new Nil <List <Double >[]>() {}.type ();
475474 final Type arrayListString = new Nil <List <String >[]>() {}.type ();
476475
477- assertEquals (Types .isApplicable (new Type [] { arrayListDouble }, new Type [] {
478- arrayListT }), - 1 );
476+ assertEquals (- 1 , Types .isApplicable (new Type [] { arrayListDouble }, new Type [] {
477+ arrayListT }));
479478 // String does not extend Number
480- assertNotEquals (Types .isApplicable (new Type [] { arrayListString },
481- new Type [] { arrayListT }), - 1 );
479+ assertNotEquals (- 1 , Types .isApplicable (new Type [] { arrayListString },
480+ new Type [] { arrayListT }));
482481 // Number does not extend BigInteger
483- assertNotEquals (Types .isApplicable (new Type [] { arrayListT }, new Type [] {
484- arrayU }), - 1 );
482+ assertNotEquals (- 1 , Types .isApplicable (new Type [] { arrayListT }, new Type [] {
483+ arrayU }));
485484
486485 }
487486
@@ -500,19 +499,19 @@ void testIsApplicableTypeVariables()
500499 .type ();
501500 final Type integerThing = new Nil <IntegerThing >() {}.type ();
502501
503- assertEquals (Types .isApplicable (new Type [] { thingInt , thingInt ,
504- numberThingInt , integerThing }, new Type [] { t , t , t , t }), - 1 );
505- assertEquals (Types .isApplicable (new Type [] { thingInt , numberThingInt ,
506- strangerThingString }, new Type [] { t , t , t }), - 1 );
507- assertEquals (Types .isApplicable (new Type [] { thingInt , numberThingInt ,
508- integerThing }, new Type [] { t , t , t }), - 1 );
509- assertEquals (Types .isApplicable (new Type [] { numberThingInt ,
510- strangeThingDouble }, new Type [] { t , t }), - 1 );
502+ assertEquals (- 1 , Types .isApplicable (new Type [] { thingInt , thingInt ,
503+ numberThingInt , integerThing }, new Type [] { t , t , t , t }));
504+ assertEquals (- 1 , Types .isApplicable (new Type [] { thingInt , numberThingInt ,
505+ strangerThingString }, new Type [] { t , t , t }));
506+ assertEquals (- 1 , Types .isApplicable (new Type [] { thingInt , numberThingInt ,
507+ integerThing }, new Type [] { t , t , t }));
508+ assertEquals (- 1 , Types .isApplicable (new Type [] { numberThingInt ,
509+ strangeThingDouble }, new Type [] { t , t }));
511510 // S cannot accommodate a Double since S is already locked to Integer from
512511 // the first argument.
513- assertNotEquals (Types .isApplicable (new Type [] { thingInt , numberThingInt ,
514- numberThingDouble }, new Type [] { t , t , t }), - 1 );
515- assertEquals (Types .isApplicable (new Type [] { u }, new Type [] { t }), - 1 );
512+ assertNotEquals (- 1 , Types .isApplicable (new Type [] { thingInt , numberThingInt ,
513+ numberThingDouble }, new Type [] { t , t , t }));
514+ assertEquals (- 1 , Types .isApplicable (new Type [] { u }, new Type [] { t }));
516515
517516 // recursive Type Variables
518517 final Type circularThing = new Nil <CircularThing >() {}.type ();
@@ -524,33 +523,31 @@ void testIsApplicableTypeVariables()
524523 final Type w = new Nil <W >() {}.type ();
525524 final Type x = new Nil <X >() {}.type ();
526525
527- assertEquals (Types .isApplicable (new Type [] { circularThing , circularThing ,
528- loopingThing }, new Type [] { t , t , t }), - 1 );
526+ assertEquals (- 1 , Types .isApplicable (new Type [] { circularThing , circularThing ,
527+ loopingThing }, new Type [] { t , t , t }));
529528 // V cannot accommodate LoopingThing since V is already locked to
530529 // CircularThing
531- assertNotEquals (Types .isApplicable (new Type [] { circularThing ,
532- circularThing , loopingThing }, new Type [] { v , v , v }), - 1 );
530+ assertNotEquals (- 1 , Types .isApplicable (new Type [] { circularThing ,
531+ circularThing , loopingThing }, new Type [] { v , v , v }));
533532 // V cannot accommodate RecursiveThing since V is already locked to
534533 // CircularThing (V has to extend RecursiveThing<itself>, not
535534 // RecursiveThing<not itself>).
536- assertNotEquals (Types .isApplicable (new Type [] { circularThing ,
537- circularThing , recursiveThingCircular }, new Type [] { v , v , v }), - 1 );
535+ assertNotEquals (- 1 , Types .isApplicable (new Type [] { circularThing ,
536+ circularThing , recursiveThingCircular }, new Type [] { v , v , v }));
538537 // V cannot accommodate RecursiveThing<CircularThing> since V must extend
539538 // RecursiveThing<V> (it cannot extend RecursiveThing<not V>)
540- assertNotEquals (Types .isApplicable (new Type [] { recursiveThingCircular ,
541- recursiveThingCircular , recursiveThingCircular }, new Type [] { v , v , v }),
542- -1 );
543- assertEquals (Types .isApplicable (new Type [] { recursiveThingCircular ,
544- recursiveThingCircular , recursiveThingCircular }, new Type [] { t , t , t }),
545- -1 );
539+ assertNotEquals (-1 , Types .isApplicable (new Type [] { recursiveThingCircular ,
540+ recursiveThingCircular , recursiveThingCircular }, new Type [] { v , v , v }));
541+ assertEquals (-1 , Types .isApplicable (new Type [] { recursiveThingCircular ,
542+ recursiveThingCircular , recursiveThingCircular }, new Type [] { t , t , t }));
546543 assertEquals (Types .isApplicable (new Type [] { circularThing , circularThing ,
547544 circularThing }, new Type [] { w , w , w }), -1 );
548545 // W cannot accommodate LoopingThing since W is already
549546 // fixed to CircularThing
550- assertNotEquals (Types .isApplicable (new Type [] { circularThing , loopingThing ,
551- circularThing }, new Type [] { w , w , w }), - 1 );
552- assertEquals (Types .isApplicable (new Type [] { circularThing , loopingThing ,
553- circularThing }, new Type [] { x , x , x }), - 1 );
547+ assertNotEquals (- 1 , Types .isApplicable (new Type [] { circularThing , loopingThing ,
548+ circularThing }, new Type [] { w , w , w }));
549+ assertEquals (- 1 , Types .isApplicable (new Type [] { circularThing , loopingThing ,
550+ circularThing }, new Type [] { x , x , x }));
554551
555552 }
556553
@@ -575,7 +572,7 @@ public <T> void testIsApplicableMatchingT() {
575572 {}.type (), //
576573 new Nil <List <Integer >>()
577574 {}.type () };
578- assertEquals (Types .isApplicable (argsOK , params ), - 1 );
575+ assertEquals (- 1 , Types .isApplicable (argsOK , params ));
579576
580577 // f(List<String>, List<Number>)
581578 // [MISS] T cannot be both String and Number
@@ -585,7 +582,7 @@ public <T> void testIsApplicableMatchingT() {
585582 new Nil <List <Number >>()
586583 {}.type () //
587584 };
588- assertNotEquals (Types .isApplicable (argsMiss , params ), - 1 );
585+ assertNotEquals (- 1 , Types .isApplicable (argsMiss , params ));
589586 }
590587
591588 @ Test
@@ -762,10 +759,10 @@ private Class<?> componentType(final Class<?> c, final String fieldName) {
762759 return Types .raw (Types .component (type (c , fieldName )));
763760 }
764761
765- private void assertAllTheSame (final List <?> list , final Object ... values ) {
766- assertEquals (list . size (), values . length );
767- for (int i = 0 ; i < values .length ; i ++) {
768- assertSame (list .get (i ), values [ i ] );
762+ private void assertAllTheSame (final List <?> actual , final Object ... expected ) {
763+ assertEquals (expected . length , actual . size () );
764+ for (int i = 0 ; i < expected .length ; i ++) {
765+ assertSame (expected [ i ], actual .get (i ));
769766 }
770767 }
771768}
0 commit comments