use of com.ctrip.platform.dal.dao.client.DalCommand.ThrowExceptionDalCommand in project dal by ctripcorp.
the class DalCommandTest method testBatchOperationThrowExceptionInDalCommand.
// Two layer transaction with exception which should throws actual exception
@Test
public void testBatchOperationThrowExceptionInDalCommand() throws Exception {
DalClient client = DalClientFactory.getClient(dbName);
try {
client.execute(new ThrowExceptionDalCommand(), new DalHints());
Assert.fail();
} catch (Throwable e) {
System.out.println(e.getMessage());
Assert.assertTrue(e instanceof BatchUpdateException);
Assert.assertTrue(e.getMessage().equals("Data truncation: Data too long for column 'Name' at row 1"));
Assert.assertTrue(isCurrentTransactionNull());
}
}
Aggregations