### Question:
TypeCoercion { public boolean canCoerce(Type fromType, Type toType) { TypeCompatibility typeCompatibility = compatibility(fromType, toType); return typeCompatibility.isCoercible(); } TypeCoercion(Function<TypeSignature, Type> lookupType); boolean isTypeOnlyCoercion(Type source, Type result); Optional<Type> getCommonSuperType(Type firstType, Type secondType); boolean isCompatible(Type fromType, Type toType); boolean canCoerce(Type fromType, Type toType); @SuppressWarnings("SwitchStatementWithTooFewBranches") Optional<Type> coerceTypeBase(Type sourceType, String resultTypeBase); static boolean isCovariantTypeBase(String typeBase);  }### Answer:
@Test public void testCanCoerceIsTransitive() { Set<Type> types = getStandardPrimitiveTypes(); for (Type transitiveType : types) { for (Type resultType : types) { if (typeCoercion.canCoerce(transitiveType, resultType)) { for (Type sourceType : types) { if (typeCoercion.canCoerce(sourceType, transitiveType)) { if (!typeCoercion.canCoerce(sourceType, resultType)) { fail(format("'%s' -> '%s' coercion is missing when transitive coercion is possible: '%s' -> '%s' -> '%s'", sourceType, resultType, sourceType, transitiveType, resultType)); } } } } } } }
@Test public void testCastOperatorsExistForCoercions() { Set<Type> types = getStandardPrimitiveTypes(); for (Type sourceType : types) { for (Type resultType : types) { if (typeCoercion.canCoerce(sourceType, resultType) && sourceType != UNKNOWN && resultType != UNKNOWN) { try { metadata.getCoercion(sourceType, resultType); } catch (Exception e) { fail(format("'%s' -> '%s' coercion exists but there is no cast operator", sourceType, resultType), e); } } } } }