@Test public void testConvertToJava() { assertEquals(true, converter.convertToJava("X")); assertEquals(true, converter.convertToJava("x")); assertEquals(true, converter.convertToJava(" X ")); assertEquals(false, converter.convertToJava("")); assertEquals(false, converter.convertToJava(" ")); assertConversionExceptionToJava("Y"); assertConversionExceptionToJava(null); }
public Boolean convertToJava(final String sapValue) { if (sapValue == null) { throw new ConversionException("SAP returned null"); } String value = sapValue.trim(); if ("X".equalsIgnoreCase(value)) { return TRUE; } else if (value.length() == 0) { return FALSE; } else { throw new ConversionException("Expected 'X' or '', but SAP returned '" + value + "'"); } }
BooleanConverter implements Converter<Boolean, String> { public Boolean convertToJava(final String sapValue) { if (sapValue == null) { throw new ConversionException("SAP returned null"); } String value = sapValue.trim(); if ("X".equalsIgnoreCase(value)) { return TRUE; } else if (value.length() == 0) { return FALSE; } else { throw new ConversionException("Expected 'X' or '', but SAP returned '" + value + "'"); } } }
BooleanConverter implements Converter<Boolean, String> { public Boolean convertToJava(final String sapValue) { if (sapValue == null) { throw new ConversionException("SAP returned null"); } String value = sapValue.trim(); if ("X".equalsIgnoreCase(value)) { return TRUE; } else if (value.length() == 0) { return FALSE; } else { throw new ConversionException("Expected 'X' or '', but SAP returned '" + value + "'"); } }  }
BooleanConverter implements Converter<Boolean, String> { public Boolean convertToJava(final String sapValue) { if (sapValue == null) { throw new ConversionException("SAP returned null"); } String value = sapValue.trim(); if ("X".equalsIgnoreCase(value)) { return TRUE; } else if (value.length() == 0) { return FALSE; } else { throw new ConversionException("Expected 'X' or '', but SAP returned '" + value + "'"); } }  Boolean convertToJava(final String sapValue); String convertToSap(final Boolean javaValue); }
BooleanConverter implements Converter<Boolean, String> { public Boolean convertToJava(final String sapValue) { if (sapValue == null) { throw new ConversionException("SAP returned null"); } String value = sapValue.trim(); if ("X".equalsIgnoreCase(value)) { return TRUE; } else if (value.length() == 0) { return FALSE; } else { throw new ConversionException("Expected 'X' or '', but SAP returned '" + value + "'"); } }  Boolean convertToJava(final String sapValue); String convertToSap(final Boolean javaValue);  }