예제 #1
0
  /** Tests get Search */
  public static void testSearch() {
    try {
      TimeTableModel model = new TimeTableModel();
      List list = new ArrayList();
      model.setSubject("O");
      list = model.search(0, 0);
      if (list.size() < 0) {
        System.out.println("Test Serach fail");
      }
      Iterator it = list.iterator();
      while (it.hasNext()) {
        model = (TimeTableModel) it.next();
        System.out.println(model.getId());
        System.out.println(model.getBranch());
        System.out.println(model.getSemester());
        System.out.println(model.getYear());
        System.out.println(model.getSubject());
        System.out.println(model.getDate());
        System.out.println(model.getTime());
        System.out.println(model.getFaculty());
      }

    } catch (ApplicationException e) {
      e.printStackTrace();
    }
  }
예제 #2
0
 /** Tests update a User */
 public static void testUpdate() {
   try {
     TimeTableModel model = new TimeTableModel();
     model = model.findByPK(1L);
     model.setSubject("OOT");
     model.update();
     TimeTableModel updatedModel = model.findByPK(1L);
     if (!"OOT".equals(updatedModel.getSubject())) {
       System.out.println("Test Update fail");
     }
   } catch (ApplicationException e) {
     e.printStackTrace();
   }
 }
예제 #3
0
 /** Tests find a User by PK. */
 public static void testFindByPK() {
   try {
     TimeTableModel model = new TimeTableModel();
     model = model.findByPK(1L);
     if (model == null) {
       System.out.println("Test Find By PK fail");
     } else {
       System.out.println(model.getId());
       System.out.println(model.getBranch());
       System.out.println(model.getSemester());
       System.out.println(model.getYear());
       System.out.println(model.getSubject());
       System.out.println(model.getDate());
       System.out.println(model.getTime());
       System.out.println(model.getFaculty());
     }
   } catch (ApplicationException e) {
     e.printStackTrace();
   }
 }