示例#1
0
  /** Test of driverRecuperaTipiAssenza method, of class ws.didattica.driver.ClasseDriver. */
  public void testDriverRecuperaClassi() {
    System.out.println("driverRecuperaClassi");

    ClasseDriver instance = new ClasseDriver();

    java.util.List<ws.didattica.driver.classeclient.Classe> result =
        instance.driverRecuperaClassi();
    assertNotNull(result);

    ws.didattica.driver.classeclient.Classe c = result.get(0);
    assertNotNull(c);
    assertEquals(5, c.getId());
    assertEquals('A', c.getSezione());
    assertEquals(new Integer(5), c.getAnnoCorso());
  }
  /**
   * Test of getProductsByCategory2 method, of class
   * thirdstage.exercise.spring.hibernate5.ProductDaoHibernateImpl3.
   */
  public void testGetProductsByCategory2() throws Exception {
    System.out.println("getProductsByCategory2");

    ProductDao dao = (ProductDao) (this.factory.getBean("productDao3"));
    String category = "cpu";
    try {
      java.util.List<Product> result = dao.getProductsByCategory2(category);

      for (int i = 0, n = result.size(); i < n; i++) {
        System.out.println("" + result.get(i).getId() + ", " + result.get(i).getName());
      }

      assertTrue(result.size() > 0);
    } catch (Exception ex) {
      System.out.println("fail");
      ex.printStackTrace(System.out);
    }
  }