### Question:
StringToBigIntegerConverterFactory implements TypeConverterFactory<String, BigInteger> { @Override public TypeConverter<String, BigInteger> createTypeConverter() { return new NumberTypeConverter<String, BigInteger>() { @Override protected BigInteger doConvert(String value) { if (numberFormat != null) { try { final Number number = numberFormat.parse(value.trim()); if (number instanceof BigInteger) { return (BigInteger) number; } else if (number instanceof BigDecimal) { return ((BigDecimal) number).toBigInteger(); } return new BigInteger(String.valueOf(number.intValue())); } catch (ParseException e) { throw new TypeConverterException("Failed to decode BigInteger value '" + value + "' using NumberFormat instance " + numberFormat + ".", e); } } else { try { return new BigInteger(value.trim()); } catch (NumberFormatException e) { throw new TypeConverterException("Failed to decode BigInteger value '" + value + "'.", e); } } } }; }  @Override TypeConverter<String, BigInteger> createTypeConverter(); @Override TypeConverterDescriptor<Class<String>, Class<BigInteger>> getTypeConverterDescriptor();  }### Answer:
@Test public void test_decode_no_config() { StringToBigIntegerConverterFactory stringToBigIntegerConverterFactory = new StringToBigIntegerConverterFactory(); BigInteger bigI = stringToBigIntegerConverterFactory.createTypeConverter().convert("1234"); assertEquals(new BigInteger("1234"), bigI); }
@Test public void test_decode_locale_config() { StringToBigIntegerConverterFactory stringToBigIntegerConverterFactory = new StringToBigIntegerConverterFactory(); Properties config = new Properties(); config.setProperty(NumberTypeConverter.LOCALE, "de-DE"); TypeConverter<String, BigInteger> typeConverter = stringToBigIntegerConverterFactory.createTypeConverter(); ((Configurable) typeConverter).setConfiguration(config); BigInteger bigI = typeConverter.convert("1234,45"); assertEquals(new BigInteger("1234"), bigI); }
@Test public void test_decode_format_config() { StringToBigIntegerConverterFactory stringToBigIntegerConverterFactory = new StringToBigIntegerConverterFactory(); Properties config = new Properties(); config.setProperty(NumberTypeConverter.FORMAT, "#,###.##"); TypeConverter<String, BigInteger> typeConverter = stringToBigIntegerConverterFactory.createTypeConverter(); ((Configurable) typeConverter).setConfiguration(config); BigInteger bigI = typeConverter.convert("1,234.45"); assertEquals(new BigInteger("1234"), bigI); }