### Question:
ToBooleanConverter implements Converter { @Override public Boolean convert(Class<?> targetClass, String strVal) throws ConvertException { if (strVal == null) { return null; } strVal = strVal.toLowerCase(); if (strVal.equals("true")) { return true; } else if (strVal.equals("false")) { return false; } else { throw new ConvertException(String.format("Failed to parse '%s' as Boolean", strVal)); } }  @Override Boolean convert(Class<?> targetClass, String strVal);  }### Answer:
@Test(dataProvider = "validValues") public void testConvertingValidValues(String from, Boolean expected) { Assert.assertEquals(toBooleanConverter.convert(Boolean.class, from), expected); }
@Test(dataProvider = "invalidValues", expectedExceptions = {ConvertException.class}) public void testConvertingValidValues(String invalidVal) { toBooleanConverter.convert(Boolean.class, invalidVal); }