use of com.mockrunner.mock.jdbc.MockResultSet in project cayenne by apache.
the class EnumTypeTest method testMaterializeNumericObjectInnerEnum.
@Test
public void testMaterializeNumericObjectInnerEnum() throws Exception {
EnumType type = new EnumType(InnerEnumHolder.InnerEnum.class);
MockResultSet rs = new MockResultSet("Test");
rs.addColumn("Enum");
rs.addRow(new Object[] { new Integer(2) });
rs.next();
Object o = type.materializeObject(rs, 1, Types.NUMERIC);
assertSame(InnerEnumHolder.InnerEnum.c, o);
}
use of com.mockrunner.mock.jdbc.MockResultSet in project cayenne by apache.
the class EnumTypeTest method testMaterializeStringObject.
@Test
public void testMaterializeStringObject() throws Exception {
EnumType type = new EnumType(MockEnum.class);
MockResultSet rs = new MockResultSet("Test");
rs.addColumn("Enum");
rs.addRow(new Object[] { "b" });
rs.next();
Object o = type.materializeObject(rs, 1, Types.VARCHAR);
assertSame(MockEnum.b, o);
}
use of com.mockrunner.mock.jdbc.MockResultSet in project cayenne by apache.
the class JDBCResultIteratorTest method testClose.
@Test
public void testClose() throws Exception {
Connection c = new MockConnection();
MockStatement s = new MockStatement(c);
MockResultSet rs = new MockResultSet("rs");
rs.addColumn("a", new Object[] { "1", "2", "3" });
RowReader<?> rowReader = mock(RowReader.class);
try (JDBCResultIterator it = new JDBCResultIterator(s, rs, rowReader)) {
assertFalse(rs.isClosed());
assertFalse(s.isClosed());
assertFalse(c.isClosed());
}
assertTrue(rs.isClosed());
assertTrue(s.isClosed());
}
Aggregations