### Question:
NumberUtil { public static int roundHalfUp(final Object obj) { if (obj instanceof Short) { return (short) obj; } if (obj instanceof Integer) { return (int) obj; } if (obj instanceof Long) { return ((Long) obj).intValue(); } if (obj instanceof Double) { return new BigDecimal((double) obj).setScale(0, BigDecimal.ROUND_HALF_UP).intValue(); } if (obj instanceof Float) { return new BigDecimal((float) obj).setScale(0, BigDecimal.ROUND_HALF_UP).intValue(); } if (obj instanceof String) { return new BigDecimal((String) obj).setScale(0, BigDecimal.ROUND_HALF_UP).intValue(); } throw new ShardingJdbcException("Invalid value to transfer: %s", obj); }  static int roundHalfUp(final Object obj); static Number getExactlyNumber(final String value, final int radix);  }### Answer:
@Test public void assertRoundHalfUpWithLong() { assertThat(NumberUtil.roundHalfUp(1L), is(1)); assertThat(NumberUtil.roundHalfUp(2L), is(2)); }
@Test public void assertRoundHalfUpWithDouble() { assertThat(NumberUtil.roundHalfUp(1.499d), is(1)); assertThat(NumberUtil.roundHalfUp(1.5d), is(2)); }
@Test public void assertRoundHalfUpWithFloat() { assertThat(NumberUtil.roundHalfUp(1.499f), is(1)); assertThat(NumberUtil.roundHalfUp(1.5f), is(2)); }
@Test public void assertRoundHalfUpWithString() { assertThat(NumberUtil.roundHalfUp("1.499"), is(1)); assertThat(NumberUtil.roundHalfUp("1.5"), is(2)); }
@Test(expected = ShardingJdbcException.class) public void assertRoundHalfUpWithInvalidType() { NumberUtil.roundHalfUp(new Object()); }
@Test public void assertRoundHalfUpWithShort() { short i = 1; short j = 2; assertThat(NumberUtil.roundHalfUp(i), is(1)); assertThat(NumberUtil.roundHalfUp(j), is(2)); }
@Test public void assertRoundHalfUpWithInteger() { assertThat(NumberUtil.roundHalfUp(1), is(1)); assertThat(NumberUtil.roundHalfUp(2), is(2)); }