@Test public void testFromIntervalNo() { PowerMock.resetAll(); final Object interval = new Object(); EasyMock.expect(this.intervalConverter.castToInterval(interval)).andReturn(null); EasyMock.expect(this.wrappedConverter.from(interval)).andReturn(EMPTY_STRING_VALUE); PowerMock.replayAll(); Assert.assertEquals(EMPTY_STRING_VALUE, this.converter.from(interval)); PowerMock.verifyAll(); }
@Override public CellValue from(final Object o) { try { if (o instanceof Clob) { final Clob clob = (Clob) o; return new StringValue(clob.getSubString(1, (int) clob.length())); } else if (o instanceof SQLXML) { final SQLXML sqlxml = (SQLXML) o; final String string = sqlxml.getString().trim(); return new StringValue(string); } else if (o instanceof Date) { final long time = ((Date) o).getTime(); return new DateValue(new Date(time)); } else if (o instanceof Time) { final long time = ((Time) o).getTime(); return new DateValue(new Date(time)); } else if (o instanceof Timestamp) { final long time = ((Timestamp) o).getTime(); return new DateValue(new Date(time)); } else { final TimeValue timeValue = this.intervalConverter.castToInterval(o); if (timeValue == null) { return this.converter.from(o); } else { return timeValue; } } } catch (final SQLException e) { throw new RuntimeException(e); } }
SQLToCellValueConverter implements ToCellValueConverter { @Override public CellValue from(final Object o) { try { if (o instanceof Clob) { final Clob clob = (Clob) o; return new StringValue(clob.getSubString(1, (int) clob.length())); } else if (o instanceof SQLXML) { final SQLXML sqlxml = (SQLXML) o; final String string = sqlxml.getString().trim(); return new StringValue(string); } else if (o instanceof Date) { final long time = ((Date) o).getTime(); return new DateValue(new Date(time)); } else if (o instanceof Time) { final long time = ((Time) o).getTime(); return new DateValue(new Date(time)); } else if (o instanceof Timestamp) { final long time = ((Timestamp) o).getTime(); return new DateValue(new Date(time)); } else { final TimeValue timeValue = this.intervalConverter.castToInterval(o); if (timeValue == null) { return this.converter.from(o); } else { return timeValue; } } } catch (final SQLException e) { throw new RuntimeException(e); } } }
SQLToCellValueConverter implements ToCellValueConverter { @Override public CellValue from(final Object o) { try { if (o instanceof Clob) { final Clob clob = (Clob) o; return new StringValue(clob.getSubString(1, (int) clob.length())); } else if (o instanceof SQLXML) { final SQLXML sqlxml = (SQLXML) o; final String string = sqlxml.getString().trim(); return new StringValue(string); } else if (o instanceof Date) { final long time = ((Date) o).getTime(); return new DateValue(new Date(time)); } else if (o instanceof Time) { final long time = ((Time) o).getTime(); return new DateValue(new Date(time)); } else if (o instanceof Timestamp) { final long time = ((Timestamp) o).getTime(); return new DateValue(new Date(time)); } else { final TimeValue timeValue = this.intervalConverter.castToInterval(o); if (timeValue == null) { return this.converter.from(o); } else { return timeValue; } } } catch (final SQLException e) { throw new RuntimeException(e); } } SQLToCellValueConverter(final ToCellValueConverter converter,
                            final IntervalConverter intervalConverter, final Charset charset); }
SQLToCellValueConverter implements ToCellValueConverter { @Override public CellValue from(final Object o) { try { if (o instanceof Clob) { final Clob clob = (Clob) o; return new StringValue(clob.getSubString(1, (int) clob.length())); } else if (o instanceof SQLXML) { final SQLXML sqlxml = (SQLXML) o; final String string = sqlxml.getString().trim(); return new StringValue(string); } else if (o instanceof Date) { final long time = ((Date) o).getTime(); return new DateValue(new Date(time)); } else if (o instanceof Time) { final long time = ((Time) o).getTime(); return new DateValue(new Date(time)); } else if (o instanceof Timestamp) { final long time = ((Timestamp) o).getTime(); return new DateValue(new Date(time)); } else { final TimeValue timeValue = this.intervalConverter.castToInterval(o); if (timeValue == null) { return this.converter.from(o); } else { return timeValue; } } } catch (final SQLException e) { throw new RuntimeException(e); } } SQLToCellValueConverter(final ToCellValueConverter converter,
                            final IntervalConverter intervalConverter, final Charset charset); static SQLToCellValueConverter create(final IntervalConverter intervalConverter,
                                                 final String currency, final Charset charset); @Override CellValue from(final Object o); @Override CellValue from(final CellType type, final Object o); }
SQLToCellValueConverter implements ToCellValueConverter { @Override public CellValue from(final Object o) { try { if (o instanceof Clob) { final Clob clob = (Clob) o; return new StringValue(clob.getSubString(1, (int) clob.length())); } else if (o instanceof SQLXML) { final SQLXML sqlxml = (SQLXML) o; final String string = sqlxml.getString().trim(); return new StringValue(string); } else if (o instanceof Date) { final long time = ((Date) o).getTime(); return new DateValue(new Date(time)); } else if (o instanceof Time) { final long time = ((Time) o).getTime(); return new DateValue(new Date(time)); } else if (o instanceof Timestamp) { final long time = ((Timestamp) o).getTime(); return new DateValue(new Date(time)); } else { final TimeValue timeValue = this.intervalConverter.castToInterval(o); if (timeValue == null) { return this.converter.from(o); } else { return timeValue; } } } catch (final SQLException e) { throw new RuntimeException(e); } } SQLToCellValueConverter(final ToCellValueConverter converter,
                            final IntervalConverter intervalConverter, final Charset charset); static SQLToCellValueConverter create(final IntervalConverter intervalConverter,
                                                 final String currency, final Charset charset); @Override CellValue from(final Object o); @Override CellValue from(final CellType type, final Object o);  }