use of com.adaptris.jdbc.JdbcResultRow in project interlok by adaptris.
the class DateColumnTranslatorTest method testDateFormatted.
@Test
public void testDateFormatted() throws Exception {
translator.setDateFormat("yyyy");
JdbcResultRow row = new JdbcResultRow();
row.setFieldValue("testField", date, Types.DATE);
{
String translated = translator.translate(row, 0);
assertEquals("2013", translated);
}
{
String translated = translator.translate(row, "testField");
assertEquals("2013", translated);
}
}
use of com.adaptris.jdbc.JdbcResultRow in project interlok by adaptris.
the class DoubleColumnTranslatorTest method testFormattedFloat.
@Test
public void testFormattedFloat() throws Exception {
translator.setFormat("%f");
Float floatVal = Float.valueOf("123");
JdbcResultRow row = new JdbcResultRow();
row.setFieldValue("testField", floatVal, Types.DOUBLE);
{
String translated = translator.translate(row, 0);
assertEquals(expected, translated);
}
{
String translated = translator.translate(row, "testField");
assertEquals(expected, translated);
}
}
use of com.adaptris.jdbc.JdbcResultRow in project interlok by adaptris.
the class DoubleColumnTranslatorTest method testIllegalFormat.
@Test
public void testIllegalFormat() throws Exception {
translator.setFormat("%zZX");
String floatVal = new String("123");
JdbcResultRow row = new JdbcResultRow();
row.setFieldValue("testField", floatVal, Types.DOUBLE);
try {
translator.translate(row, 0);
fail();
} catch (Exception ex) {
// expected
}
}
use of com.adaptris.jdbc.JdbcResultRow in project interlok by adaptris.
the class DoubleColumnTranslatorTest method testFormattedInteger.
@Test
public void testFormattedInteger() throws Exception {
translator.setFormat("%f");
Integer floatVal = Integer.valueOf("123");
JdbcResultRow row = new JdbcResultRow();
row.setFieldValue("testField", floatVal, Types.DOUBLE);
{
String translated = translator.translate(row, 0);
assertEquals(expected, translated);
}
{
String translated = translator.translate(row, "testField");
assertEquals(expected, translated);
}
}
use of com.adaptris.jdbc.JdbcResultRow in project interlok by adaptris.
the class FloatColumnTranslatorTest method testFormattedInteger.
@Test
public void testFormattedInteger() throws Exception {
translator.setFormat("%f");
Integer floatVal = Integer.valueOf("123");
JdbcResultRow row = new JdbcResultRow();
row.setFieldValue("testField", floatVal, Types.FLOAT);
{
String translated = translator.translate(row, 0);
assertEquals(expected, translated);
}
{
String translated = translator.translate(row, "testField");
assertEquals(expected, translated);
}
}
Aggregations