use of com.adaptris.jdbc.JdbcResultRow in project interlok by adaptris.
the class StringColumnTranslatorTest method testAsFloatTranslator.
@Test
public void testAsFloatTranslator() throws Exception {
JdbcResultRow row = new JdbcResultRow();
row.setFieldValue("testField", new Float(111), Types.VARCHAR);
{
String translated = translator.translate(row, 0);
assertEquals("111.0", translated);
}
{
String translated = translator.translate(row, "testField");
assertEquals("111.0", translated);
}
}
use of com.adaptris.jdbc.JdbcResultRow in project interlok by adaptris.
the class StringColumnTranslatorTest method testAsDoubleTranslator.
@Test
public void testAsDoubleTranslator() throws Exception {
JdbcResultRow row = new JdbcResultRow();
row.setFieldValue("testField", new Double(111), Types.VARCHAR);
{
String translated = translator.translate(row, 0);
assertEquals("111.0", translated);
}
{
String translated = translator.translate(row, "testField");
assertEquals("111.0", translated);
}
}
use of com.adaptris.jdbc.JdbcResultRow in project interlok by adaptris.
the class TimeColumnTranslatorTest method testGregorianFormatted.
@Test
public void testGregorianFormatted() throws Exception {
translator.setDateFormat("HH:mm:ss");
JdbcResultRow row = new JdbcResultRow();
row.setFieldValue("testField", gDate, Types.TIME);
{
String translated = translator.translate(row, 0);
assertEquals("12:12:12", translated);
}
{
String translated = translator.translate(row, "testField");
assertEquals("12:12:12", translated);
}
}
use of com.adaptris.jdbc.JdbcResultRow in project interlok by adaptris.
the class TimeColumnTranslatorTest method testDateFormatted.
@Test
public void testDateFormatted() throws Exception {
translator.setDateFormat("HH:mm");
JdbcResultRow row = new JdbcResultRow();
row.setFieldValue("testField", date, Types.TIME);
{
String translated = translator.translate(row, 0);
assertEquals("12:12", translated);
}
{
String translated = translator.translate(row, "testField");
assertEquals("12:12", translated);
}
}
use of com.adaptris.jdbc.JdbcResultRow in project interlok by adaptris.
the class TimeColumnTranslatorTest method testDateNoFormat.
@Test
public void testDateNoFormat() throws Exception {
JdbcResultRow row = new JdbcResultRow();
row.setFieldValue("testField", date, Types.TIME);
{
String translated = translator.translate(row, 0);
// starts with, being careful of timezone
assertTrue(translated.startsWith("12:12:12"));
}
{
String translated = translator.translate(row, "testField");
// starts with, being careful of timezone
assertTrue(translated.startsWith("12:12:12"));
}
}
Aggregations