CellUtilities { public void removeCommaSeparatedValue(DTCellValue52 dcv) { if (dcv == null) { return; } if (dcv.getDataType().equals(DataType.DataTypes.STRING)) { if (dcv.getStringValue() == null) { return; } String[] values = dcv.getStringValue().split(","); if (values.length > 0) { dcv.setStringValue(values[0]); } } }  static void injectDateConvertor(DateConverter dc); void convertDTCellValueType(DataType.DataTypes dataType,
                                       DTCellValue52 dcv); String asString(final DTCellValue52 dcv); void removeCommaSeparatedValue(DTCellValue52 dcv); BigDecimal convertToBigDecimal(final DTCellValue52 cell); BigInteger convertToBigInteger(final DTCellValue52 cell); Byte convertToByte(final DTCellValue52 cell); Double convertToDouble(final DTCellValue52 cell); Float convertToFloat(final DTCellValue52 cell); Integer convertToInteger(final DTCellValue52 cell); Long convertToLong(final DTCellValue52 cell); Short convertToShort(final DTCellValue52 cell); Date convertToDate(final DTCellValue52 cell); Boolean convertToBoolean(final DTCellValue52 cell); String convertToString(final DTCellValue52 cell);  }
@Test public void testRemoveCommaSeparatedValue() { DTCellValue52 dcv; dcv = new DTCellValue52(1); cellUtilities.removeCommaSeparatedValue(dcv); assertEquals(1, dcv.getNumericValue()); assertNull(dcv.getBooleanValue()); assertNull(dcv.getStringValue()); assertNull(dcv.getDateValue()); assertEquals(DataType.DataTypes.NUMERIC_INTEGER, dcv.getDataType()); dcv = new DTCellValue52(1L); cellUtilities.removeCommaSeparatedValue(dcv); assertEquals(1L, dcv.getNumericValue()); assertNull(dcv.getBooleanValue()); assertNull(dcv.getStringValue()); assertNull(dcv.getDateValue()); assertEquals(DataType.DataTypes.NUMERIC_LONG, dcv.getDataType()); dcv = new DTCellValue52(1.0); cellUtilities.removeCommaSeparatedValue(dcv); assertEquals(1.0, dcv.getNumericValue()); assertNull(dcv.getBooleanValue()); assertNull(dcv.getStringValue()); assertNull(dcv.getDateValue()); assertEquals(DataType.DataTypes.NUMERIC_DOUBLE, dcv.getDataType()); dcv = new DTCellValue52("Fred"); cellUtilities.removeCommaSeparatedValue(dcv); assertEquals("Fred", dcv.getStringValue()); assertNull(dcv.getBooleanValue()); assertNull(dcv.getNumericValue()); assertNull(dcv.getDateValue()); assertEquals(DataType.DataTypes.STRING, dcv.getDataType()); dcv = new DTCellValue52("Fred,Ginger"); cellUtilities.removeCommaSeparatedValue(dcv); assertEquals("Fred", dcv.getStringValue()); assertNull(dcv.getBooleanValue()); assertNull(dcv.getNumericValue()); assertNull(dcv.getDateValue()); assertEquals(DataType.DataTypes.STRING, dcv.getDataType()); dcv = new DTCellValue52(",Ginger"); cellUtilities.removeCommaSeparatedValue(dcv); assertEquals("", dcv.getStringValue()); assertNull(dcv.getBooleanValue()); assertNull(dcv.getNumericValue()); assertNull(dcv.getDateValue()); assertEquals(DataType.DataTypes.STRING, dcv.getDataType()); dcv = new DTCellValue52("Fred,"); cellUtilities.removeCommaSeparatedValue(dcv); assertEquals("Fred", dcv.getStringValue()); assertNull(dcv.getBooleanValue()); assertNull(dcv.getNumericValue()); assertNull(dcv.getDateValue()); assertEquals(DataType.DataTypes.STRING, dcv.getDataType()); }