ShortTypeConverter implements TypeConverter<String, Short> { @Override public Short convert(final String value) { Utils.checkArgument(value != null, "Value to convert must not be null"); Utils.checkArgument(!value.isEmpty(), "Value to convert must not be empty"); return Double.valueOf(value).shortValue(); }  @Override Short convert(final String value);  }
@Test public void whenInputIsLegalValue_ThenShouldReturnShort() { assertThat(converter.convert("5")).isEqualTo((short) 5); assertThat(converter.convert("5.0")).isEqualTo((short) 5); }