### Question:
TypeUtil { static public Object cast(DataType dataType, Object value){ switch(dataType){ case STRING: return toString(value); case INTEGER: return toInteger(value); case FLOAT: return toFloat(value); case DOUBLE: return toDouble(value); case BOOLEAN: return toBoolean(value); case DATE: return toDate(value); case TIME: return toTime(value); case DATE_TIME: return toDateTime(value); case DATE_DAYS_SINCE_1960: return toDaysSinceDate(value, YEAR_1960); case DATE_DAYS_SINCE_1970: return toDaysSinceDate(value, YEAR_1970); case DATE_DAYS_SINCE_1980: return toDaysSinceDate(value, YEAR_1980); case TIME_SECONDS: return toSecondsSinceMidnight(value); case DATE_TIME_SECONDS_SINCE_1960: return toSecondsSinceDate(value, YEAR_1960); case DATE_TIME_SECONDS_SINCE_1970: return toSecondsSinceDate(value, YEAR_1970); case DATE_TIME_SECONDS_SINCE_1980: return toSecondsSinceDate(value, YEAR_1980); default: break; } throw new EvaluationException(); } private  TypeUtil(); static boolean equals(DataType dataType, Object left, Object right); @SuppressWarnings ( value = {"rawtypes", "unchecked"} ) static int compare(DataType dataType, Object left, Object right); static Object parseOrCast(DataType dataType, Object value); static Object parse(DataType dataType, String value); static String format(Object value); static DataType getDataType(Object value); static DataType getResultDataType(DataType left, DataType right); static OpType getOpType(DataType dataType); static Object cast(DataType dataType, Object value); static DataType getConstantDataType(String string);  }### Answer:
@Test public void cast(){ assertEquals("1", TypeUtil.cast(DataType.STRING, "1")); assertEquals("1", TypeUtil.cast(DataType.STRING, 1)); assertEquals("1.0", TypeUtil.cast(DataType.STRING, 1f)); assertEquals("1.0", TypeUtil.cast(DataType.STRING, 1.0f)); assertEquals("1.0", TypeUtil.cast(DataType.STRING, 1d)); assertEquals("1.0", TypeUtil.cast(DataType.STRING, 1.0d)); assertEquals(1, TypeUtil.cast(DataType.INTEGER, 1)); assertEquals(1f, TypeUtil.cast(DataType.FLOAT, 1)); assertEquals(1f, TypeUtil.cast(DataType.FLOAT, 1f)); assertEquals(1d, TypeUtil.cast(DataType.DOUBLE, 1)); assertEquals(1d, TypeUtil.cast(DataType.DOUBLE, 1f)); assertEquals(1d, TypeUtil.cast(DataType.DOUBLE, 1d)); }