### Question:
Arith { public static Type promote(Type operand1, Type operand2) { if ((operand1 instanceof BigIntegerType && operand2 instanceof DoubleType) || (operand1 instanceof DoubleType && operand2 instanceof BigIntegerType)) { return BigDecimalType.TYPE; } else { int o1 = arithType(operand1); int o2 = arithType(operand2); return arithType(Math.max(o1, o2)); } } private  Arith(); static Object add(Object operand1,
                             Object operand2,
                             Type resultType); static Type promote(Type operand1,
                               Type operand2);  }### Answer:
@Test public void testPromoteBigDecimalAndBigDecimalResultsInBigDecimalType() { Assert.assertEquals(BigDecimalType.TYPE, Arith.promote(BigDecimalType.TYPE, BigDecimalType.TYPE)); }
@Test public void testPromoteBigDecimalAndBigIntegerResultsInBigDecimalType() { Assert.assertEquals(BigDecimalType.TYPE, Arith.promote(BigDecimalType.TYPE, BigIntegerType.TYPE)); }
@Test public void testPromoteBigDecimalAndDoubleResultsInBigDecimalType() { Assert.assertEquals(BigDecimalType.TYPE, Arith.promote(BigDecimalType.TYPE, DoubleType.TYPE)); }
@Test public void testPromoteBigIntegerAndBigDecimalResultsInBigDecimalType() { Assert.assertEquals(BigDecimalType.TYPE, Arith.promote(DoubleType.TYPE, BigIntegerType.TYPE)); }
@Test public void testPromoteBigIntegerAndBigIntegerResultsInBigIntegerType() { Assert.assertEquals(BigIntegerType.TYPE, Arith.promote(BigIntegerType.TYPE, BigIntegerType.TYPE)); }
@Test public void testPromoteBigIntegerAndDoubleResultsInBigDecimalType() { Assert.assertEquals(BigDecimalType.TYPE, Arith.promote(BigIntegerType.TYPE, DoubleType.TYPE)); }
@Test public void testPromoteDoubleAndBigDecimalResultsInBigDecimalType() { Assert.assertEquals(BigDecimalType.TYPE, Arith.promote(DoubleType.TYPE, BigDecimalType.TYPE)); }
@Test public void testPromoteDoubleAndBigIntegerResultsInBigDecimalType() { Assert.assertEquals(BigDecimalType.TYPE, Arith.promote(DoubleType.TYPE, BigIntegerType.TYPE)); }
@Test public void testPromoteDoubleAndDoubleResultsInDoubleType() { Assert.assertEquals(DoubleType.TYPE, Arith.promote(DoubleType.TYPE, DoubleType.TYPE)); }
@Test public void testPromoteIntegerAndIntegerResultsInIntegerType() { Assert.assertEquals(IntegerType.TYPE, Arith.promote(IntegerType.TYPE, IntegerType.TYPE)); }
@Test(expected = IllegalArgumentException.class) public void testNonNumberTypeResultsInIllegalArgumentException() { Arith.promote(DoubleType.TYPE, StringType.TYPE); }