use of com.airhacks.enhydrator.in.Row in project enhydrator by AdamBien.
the class JDBCSinkTest method numberValueList.
public void numberValueList() {
String expected = "1,2";
Row row = new Row();
row.addColumn(-1, "a", 1);
row.addColumn(-1, "b", 2);
String columns = JDBCSink.valueList(row);
assertThat(columns, is(expected));
}
use of com.airhacks.enhydrator.in.Row in project enhydrator by AdamBien.
the class PojoSinkTest method pojoWithoutRelation.
@Test
public void pojoWithoutRelation() {
CachingConsumer consumer = new CachingConsumer();
PojoSink sink = new PojoSink(DeveloperWithoutKids.class, consumer, null);
final String expected = "duke";
Row parent = new Row();
parent.addColumn(-1, "name", expected);
final int expectedRanking = 2;
final String expectedLanguageName = "java";
Row programming = new Row();
programming.addColumn(-1, "name", expectedLanguageName);
programming.addColumn(-1, "ranking", expectedRanking);
parent.add(programming);
sink.processRow(parent);
DeveloperWithoutKids kidless = (DeveloperWithoutKids) consumer.getObject();
assertNotNull(kidless);
}
use of com.airhacks.enhydrator.in.Row in project enhydrator by AdamBien.
the class PojoSinkTest method doubleMapping.
@Test
public void doubleMapping() {
final double expected = 1.5;
Row row = new Row();
row.addColumn(-1, "weight", expected);
this.cut.processRow(row);
Developer dev = getDeveloper();
double actual = dev.getWeight();
assertThat(actual, is(expected));
}
use of com.airhacks.enhydrator.in.Row in project enhydrator by AdamBien.
the class PojoSinkTest method pojoWithAnnotatedField.
@Test
public void pojoWithAnnotatedField() {
CachingConsumer consumer = new CachingConsumer();
PojoSink sink = new PojoSink(DeveloperWithAnnotatedField.class, consumer, null);
final String expectedName = "duke";
final int expectedAge = 42;
Row programming = new Row();
programming.addColumn(-1, "name", expectedName);
programming.addColumn(-1, "age", expectedAge);
sink.processRow(programming);
DeveloperWithAnnotatedField kidless = (DeveloperWithAnnotatedField) consumer.getObject();
assertNotNull(kidless);
}
use of com.airhacks.enhydrator.in.Row in project enhydrator by AdamBien.
the class PojoSinkTest method typeMismatch.
@Test(expected = IllegalArgumentException.class)
public void typeMismatch() {
final double expected = 1.5;
Row row = new Row();
//name is String
row.addColumn(-1, "name", expected);
this.cut.processRow(row);
}
Aggregations