### Question:
ToLongConverter implements Converter { @Override public Long convert(Class<?> targetClass, String strVal) { if (strVal == null) { return null; } try { return Long.parseLong(strVal); } catch (NumberFormatException ex) { throw new ConvertException( String.format("Cannot convert string '%s' to Long", strVal)); } }  @Override Long convert(Class<?> targetClass, String strVal);  }### Answer:
@Test(dataProvider = "toLongConverter") public void testToIntegerConverter(String from, Long expectedLong) throws Exception { Assert.assertEquals(toLongConverter.convert(Long.class, from), expectedLong); }
@Test(dataProvider = "unconvertableValues", expectedExceptions = {ConvertException.class}) public void testUnconvertableValues(String val) throws ConvertException { toLongConverter.convert(Long.class, val); }