本文整理汇总了Java中com.alibaba.cobar.manager.jdbcmock.domain.SalesOrder类的典型用法代码示例。如果您正苦于以下问题:Java SalesOrder类的具体用法?Java SalesOrder怎么用?Java SalesOrder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SalesOrder类属于com.alibaba.cobar.manager.jdbcmock.domain包,在下文中一共展示了SalesOrder类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test
import com.alibaba.cobar.manager.jdbcmock.domain.SalesOrder; //导入依赖的package包/类
public void test() {
IMocksControl control = EasyMock.createControl();
DBUtility mockDBUtility = control.createMock(DBUtility.class);
Connection mockConnection = control.createMock(Connection.class);
Statement mockStatement = control.createMock(Statement.class);
ResultSet mockResultSet = control.createMock(ResultSet.class);
try {
mockDBUtility.getConnection();
EasyMock.expectLastCall().andStubReturn(mockConnection);
mockConnection.createStatement();
EasyMock.expectLastCall().andStubReturn(mockStatement);
mockStatement.executeQuery(SQLEquals.sqlEquals("SELECT * FROM sales_order_table"));
EasyMock.expectLastCall().andStubReturn(mockResultSet);
mockResultSet.next();
EasyMock.expectLastCall().andReturn(true).times(3);
EasyMock.expectLastCall().andReturn(false).times(1);
mockResultSet.getString(1);
EasyMock.expectLastCall().andReturn("DEMO_ORDER_001").times(1);
EasyMock.expectLastCall().andReturn("DEMO_ORDER_002").times(1);
EasyMock.expectLastCall().andReturn("DEMO_ORDER_003").times(1);
mockResultSet.getString(2);
EasyMock.expectLastCall().andReturn("Asia Pacific").times(1);
EasyMock.expectLastCall().andReturn("Europe").times(1);
EasyMock.expectLastCall().andReturn("America").times(1);
mockResultSet.getDouble(3);
EasyMock.expectLastCall().andReturn(350.0).times(1);
EasyMock.expectLastCall().andReturn(1350.0).times(1);
EasyMock.expectLastCall().andReturn(5350.0).times(1);
control.replay();
Connection conn = mockDBUtility.getConnection();
Statement stat = conn.createStatement();
ResultSet rs = stat.executeQuery("select * from sales_order_table");
int i = 0;
String[] priceLevels = { "Level_A", "Level_C", "Level_E" };
while (rs.next()) {
SalesOrder order = new SalesOrderImpl();
order.loadDataFromDB(rs);
assertEquals(order.getPriceLevel(), priceLevels[i]);
i++;
}
control.verify();
} catch (Exception e) {
e.printStackTrace();
}
}