Пример #1
0
 @Test
 public void testFindAll() throws Exception {
   Application application = new Application();
   application.setId(UUID.randomUUID());
   applicationDao.save(application);
   List<Application> applications = applicationDao.getAll();
   assertNotNull(applications);
   applicationDao.delete(application.getId());
 }
Пример #2
0
 @Test
 public void testAdd() {
   Application application = new Application();
   application.setId(UUID.randomUUID());
   application.setAnswer("答案");
   applicationDao.save(application);
   Application a = applicationDao.get(application.getId());
   System.out.println(a);
   System.out.println(application.getId());
   assertEquals("答案", a.getAnswer());
   applicationDao.delete(a.getId());
 }
Пример #3
0
 @Test
 public void testFindByState() throws Exception {
   Application application = new Application();
   application.setId(UUID.randomUUID());
   State state = new State();
   state.setId(UUID.randomUUID());
   application.setState(state);
   stateDao.save(state);
   applicationDao.save(application);
   List<Application> actual = applicationDao.findByState(state);
   assertEquals(1, actual.size());
   applicationDao.delete(application);
   stateDao.delete(state);
 }
Пример #4
0
 @Test
 public void testFindByStateAndStudent() throws Exception {
   Application application = new Application();
   application.setId(UUID.randomUUID());
   State state = new State();
   state.setId(UUID.randomUUID());
   application.setState(state);
   Student student = new Student();
   student.setId(UUID.randomUUID());
   application.setStudent(student);
   stateDao.save(state);
   studentDao.save(student);
   applicationDao.save(application);
   Application actual = applicationDao.find(state, student);
   assertEquals(application.getId(), actual.getId());
   applicationDao.delete(application);
   studentDao.delete(student);
   stateDao.delete(state);
 }
Пример #5
0
 @Test
 public void test() {
   Application application = new Application();
   application.setId(UUID.randomUUID());
   application.setCreatedDate(null);
   application.setExamState(null);
   application.setTimeCount(null);
   application.setApplicationDate(null);
   application.setUpdatedDate(null);
   application.setApplicationTime(null);
   List<State> states = stateDao.getAll();
   Map<String, Object> map = new HashMap<String, Object>();
   map.put("state", states.get(0));
   PageBean<Application> pages = applicationDao.getPageByExample(application, 1, 2, map);
 }