TypeValidator { public static boolean isSupportedForJoin(TInstance type1, TInstance type2) { TClass tclass1 = TInstance.tClass(type1); TClass tclass2 = TInstance.tClass(type2); return ((tclass1 != null) && (tclass2 != null) && isSupportedForJoin(tclass1, tclass2)); } private  TypeValidator(); static boolean isSupportedForColumn(TInstance type); static boolean isSupportedForColumn(TClass type); static boolean isSupportedForIndex(TInstance type); static boolean isSupportedForNonPointSpatialIndex(TInstance type); static boolean isSupportedForIndex(TClass type); static boolean isSupportedForJoin(TInstance type1, TInstance type2); static boolean isSupportedForJoin(TClass tclass1, TClass tclass2); static boolean isSupportedForGenerator(TInstance instance);  }
@Test public void testTypesCanBeJoined() throws Exception { for(TClass t : typesRegistry.getTypeClasses()) { assertTrue(t.toString(), TypeValidator.isSupportedForJoin(t, t)); } final String intTypeNames[] = {"tinyint", "smallint", "int", "mediumint", "bigint"}; for(String t1 : intTypeNames) { String t1U = t1 + " unsigned"; for(String t2 : intTypeNames) { String t2U = t2 + " unsigned"; boolean t1UIsBigint = "bigint unsigned".equals(t1U); boolean t2UIsBigint = "bigint unsigned".equals(t2U); assertTrue(t1+"->"+t2, canTypesBeJoined("MCOMPAT", t1, "MCOMPAT", t2)); assertEquals(t1U + "->" + t2, !t1UIsBigint, canTypesBeJoined("MCOMPAT", t1U, "MCOMPAT", t2)); assertEquals(t1 + "->" + t2U, !t2UIsBigint, canTypesBeJoined("MCOMPAT", t1, "MCOMPAT", t2U)); assertEquals(t1U+"->"+t2U, (t1UIsBigint == t2UIsBigint), canTypesBeJoined("MCOMPAT", t1U, "MCOMPAT", t2U)); } } assertFalse(canTypesBeJoined("MCOMPAT", "int", "MCOMPAT", "varchar")); assertFalse(canTypesBeJoined("MCOMPAT", "int", "MCOMPAT", "timestamp")); assertFalse(canTypesBeJoined("MCOMPAT", "int", "MCOMPAT", "decimal")); assertFalse(canTypesBeJoined("MCOMPAT", "int", "MCOMPAT", "double")); assertFalse(canTypesBeJoined("MCOMPAT", "char", "MCOMPAT", "binary")); }