### Question:
ShardingProperties { @SuppressWarnings("unchecked") public <T> T getValue(final ShardingPropertiesConstant shardingPropertiesConstant) { String result = props.getProperty(shardingPropertiesConstant.getKey(), shardingPropertiesConstant.getDefaultValue()); if (boolean.class == shardingPropertiesConstant.getType()) { return (T) Boolean.valueOf(result); } if (int.class == shardingPropertiesConstant.getType()) { return (T) Integer.valueOf(result); } if (long.class == shardingPropertiesConstant.getType()) { return (T) Long.valueOf(result); } return (T) result; } ShardingProperties(final Properties props); @SuppressWarnings("unchecked") T getValue(final ShardingPropertiesConstant shardingPropertiesConstant);  }### Answer:
@Test public void assertGetValueForDefaultValue() { ShardingProperties shardingProperties = new ShardingProperties(new Properties()); boolean actualMetricsEnabled = shardingProperties.getValue(ShardingPropertiesConstant.METRICS_ENABLE); long actualMetricsMillisecondsPeriod = shardingProperties.getValue(ShardingPropertiesConstant.METRICS_MILLISECONDS_PERIOD); assertThat(actualMetricsEnabled, is(Boolean.valueOf(ShardingPropertiesConstant.METRICS_ENABLE.getDefaultValue()))); assertThat(actualMetricsMillisecondsPeriod, is(Long.valueOf(ShardingPropertiesConstant.METRICS_MILLISECONDS_PERIOD.getDefaultValue()))); int executorMaxSize = shardingProperties.getValue(ShardingPropertiesConstant.EXECUTOR_SIZE); assertThat(executorMaxSize, is(Integer.valueOf(ShardingPropertiesConstant.EXECUTOR_SIZE.getDefaultValue()))); }
@Test public void assertGetValueForBoolean() { boolean actualMetricsEnabled = shardingProperties.getValue(ShardingPropertiesConstant.METRICS_ENABLE); assertTrue(actualMetricsEnabled); boolean showSql = shardingProperties.getValue(ShardingPropertiesConstant.SQL_SHOW); assertTrue(showSql); }
@Test public void assertGetValueForInteger() { int actualExecutorMaxSize = shardingProperties.getValue(ShardingPropertiesConstant.EXECUTOR_SIZE); assertThat(actualExecutorMaxSize, is(10)); }
@Test public void assertGetValueForLong() { long actualMetricsMillisecondsPeriod = shardingProperties.getValue(ShardingPropertiesConstant.METRICS_MILLISECONDS_PERIOD); assertThat(actualMetricsMillisecondsPeriod, is(1000L)); }