### Question:
Arith { public static Object add(Object operand1, Object operand2, Type resultType) { Object o1 = resultType.cast(operand1); Object o2 = resultType.cast(operand2); Object result; if (resultType instanceof BigDecimalType) { result = ((BigDecimal) o1).add((BigDecimal) o2); } else if (resultType instanceof BigIntegerType) { result = ((BigInteger) o1).add((BigInteger) o2); } else if (resultType instanceof DoubleType) { result = ((Double) o1).doubleValue() + ((Double) o2).doubleValue(); } else { result = ((Long) o1).longValue() + ((Long) o2).longValue(); } return result; } private  Arith(); static Object add(Object operand1,
                             Object operand2,
                             Type resultType); static Type promote(Type operand1,
                               Type operand2);  }### Answer:
@Test public void testAddBigDecimalWithBigDecimalOutput() { Assert.assertEquals(new BigDecimal(20), Arith.add(new BigDecimal(10.0), new BigDecimal(10.0), BigDecimalType.TYPE)); }
@Test public void testAddBigIntegerWithBigIntegerOutput() { Assert.assertEquals(new BigInteger("20", 10), Arith.add(new BigInteger("10", 10), new BigInteger("10", 10), BigIntegerType.TYPE)); }
@Test public void testAddDoubleWithDoubleOutput() { Assert.assertEquals(new Double(20), Arith.add(new Double(10), new Double(10), DoubleType.TYPE)); }
@Test public void testAddLongWithLongOutput() { Assert.assertEquals(new Long(20), Arith.add(new Long(10), new Long(10), IntegerType.TYPE)); }