PrimitiveBoxedUtils { public static boolean areSameWithBoxing(Class<?> a, Class<?> b) { Optional<PrimitiveBoxed> pmmlPrimitiveBoxed = getKiePMMLPrimitiveBoxed(a); return pmmlPrimitiveBoxed.filter(kiePMMLPrimitiveBoxed -> a.equals(b) || kiePMMLPrimitiveBoxed.isSameWithBoxing(b)).isPresent(); } private  PrimitiveBoxedUtils(); static Optional<PrimitiveBoxed> getKiePMMLPrimitiveBoxed(Class<?> c); static boolean areSameWithBoxing(Class<?> a, Class<?> b);  }
@Test public void areSameWithBoxing() { for (int i = 0; i < types; i++) { assertTrue(PrimitiveBoxedUtils.areSameWithBoxing(primitives[i], boxeds[i])); assertTrue(PrimitiveBoxedUtils.areSameWithBoxing(boxeds[i], primitives[i])); assertTrue(PrimitiveBoxedUtils.areSameWithBoxing(primitives[i], primitives[i])); assertTrue(PrimitiveBoxedUtils.areSameWithBoxing(boxeds[i], boxeds[i])); } for (int i = 0; i < types; i++) { assertFalse(PrimitiveBoxedUtils.areSameWithBoxing(primitives[i], boxeds[types - 1 - i])); assertFalse(PrimitiveBoxedUtils.areSameWithBoxing(boxeds[i], primitives[types - 1 - i])); } assertFalse(PrimitiveBoxedUtils.areSameWithBoxing(String.class, String.class)); assertFalse(PrimitiveBoxedUtils.areSameWithBoxing(double.class, String.class)); assertFalse(PrimitiveBoxedUtils.areSameWithBoxing(String.class, Double.class)); }