use of test.com.ctrip.platform.dal.dao.unitbase.ClientTestModel in project dal by ctripcorp.
the class DalTableDaoTestStub method testQueryLike.
/**
* Query against sample entity
* @throws SQLException
*/
@Test
public void testQueryLike() throws SQLException {
ClientTestModel pk = new ClientTestModel();
pk.setType((short) 1);
List<ClientTestModel> models = dao.queryLike(pk, new DalHints());
Assert.assertTrue(null != models);
Assert.assertEquals(3, models.size());
}
use of test.com.ctrip.platform.dal.dao.unitbase.ClientTestModel in project dal by ctripcorp.
the class DalTableDaoTestStub method testQueryByPk.
/**
* Test Query by Primary key
* @throws SQLException
*/
@Test
public void testQueryByPk() throws SQLException {
ClientTestModel model = dao.queryByPk(1, new DalHints());
Assert.assertTrue(null != model);
Assert.assertEquals(10, model.getQuantity().intValue());
}
use of test.com.ctrip.platform.dal.dao.unitbase.ClientTestModel in project dal by ctripcorp.
the class DalTableDaoTestStub method testDelete.
/**
* Test delete single entities
* @throws SQLException
*/
@Test
public void testDelete() throws SQLException {
ClientTestModel model = new ClientTestModel();
model.setId(1);
int res = dao.delete(new DalHints(), model);
Assert.assertEquals(1, res, 4 - 1);
}
use of test.com.ctrip.platform.dal.dao.unitbase.ClientTestModel in project dal by ctripcorp.
the class DalTableDaoTestStub method testInsertCheckForData.
/**
* Test Insert with null or empty parameters
* @throws SQLException
*/
@Test
public void testInsertCheckForData() throws SQLException {
ClientTestModel model = null;
try {
dao.insert(new DalHints(), model);
Assert.fail();
} catch (Exception e) {
}
List<ClientTestModel> models = null;
try {
dao.insert(new DalHints(), models);
Assert.fail();
} catch (Exception e) {
}
models = new ArrayList<>();
int[] res = dao.insert(new DalHints(), models);
Assert.assertEquals(0, res.length);
}
use of test.com.ctrip.platform.dal.dao.unitbase.ClientTestModel in project dal by ctripcorp.
the class DalTableDaoTestStub method testQueryTopWithWhereClauseFailed.
/**
* Test Query the top rows with where clause failed
* @throws SQLException
*/
@Test
public void testQueryTopWithWhereClauseFailed() throws SQLException {
String whereClause = "type=?";
StatementParameters parameters = new StatementParameters();
parameters.set(1, Types.SMALLINT, 10);
List<ClientTestModel> models = dao.queryTop(whereClause, parameters, new DalHints(), 2);
Assert.assertTrue(null != models);
Assert.assertEquals(0, models.size());
}
Aggregations