use of com.adaptris.jdbc.JdbcResultRow in project interlok by adaptris.
the class FloatColumnTranslatorTest 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.FLOAT);
try {
translator.translate(row, 0);
fail();
} catch (Exception ex) {
// expected
}
try {
translator.translate(row, "testField");
fail();
} catch (Exception ex) {
// expected
}
}
use of com.adaptris.jdbc.JdbcResultRow in project interlok by adaptris.
the class FloatColumnTranslatorTest 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.FLOAT);
{
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 IntegerColumnTranslatorTest method testFormattedString.
@Test
public void testFormattedString() throws Exception {
translator.setFormat("%05d");
String stringVal = "123";
JdbcResultRow row = new JdbcResultRow();
row.setFieldValue("testField", stringVal, Types.INTEGER);
{
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 IntegerColumnTranslatorTest method testIllegalFormat.
@Test
public void testIllegalFormat() throws Exception {
translator.setFormat("%zZX");
Integer intVal = Integer.valueOf("123");
JdbcResultRow row = new JdbcResultRow();
row.setFieldValue("testField", intVal, Types.INTEGER);
try {
translator.translate(row, 0);
fail();
} catch (Exception ex) {
// expected
}
}
use of com.adaptris.jdbc.JdbcResultRow in project interlok by adaptris.
the class StringColumnTranslatorTest method testAsIntegerTranslator.
@Test
public void testAsIntegerTranslator() throws Exception {
JdbcResultRow row = new JdbcResultRow();
row.setFieldValue("testField", new Integer(111), Types.VARCHAR);
{
String translated = translator.translate(row, 0);
assertEquals("111", translated);
}
{
String translated = translator.translate(row, "testField");
assertEquals("111", translated);
}
}
Aggregations