Package test.org.magicbox.dbunit

Examples of test.org.magicbox.dbunit.DBCentri


  }
 
  @SuppressWarnings("unchecked")
  public void testElenco() throws Exception {

    DBCentri dbCentro = new DBCentri();
    dbCentro.preparaDb();

    _reqMock = new MockHttpServletRequest("GET", "/centri.admin?action=elenco");

    ModelAndView mav = _controller.elenco(_reqMock, _resMock);
    assertEquals("admin/elencoCentri", mav.getViewName());
    List centri = (List) mav.getModel().get(Constant.ELENCO_CENTRI);
    assertEquals(2,centri.size() );
    int pagina = (Integer) mav.getModel().get(Constant.NUMERO_PAGINA_ELENCO);
    assertEquals(pagina, 0);
   
    dbCentro.pulisciDb();
    dbCentro = null;
  }
View Full Code Here


    dbCentro = null;
  }
 
  public void testDettaglio() throws Exception {

    DBCentri dbCentro = new DBCentri();
    dbCentro.preparaDb();

    _reqMock = new MockHttpServletRequest("GET", "/centri.admin?action=dettaglio");
    _reqMock.setParameter(Constant.ID, "46");
    ModelAndView mav = _controller.dettaglio(_reqMock, _resMock);
    assertEquals("admin/dettaglioCentro", mav.getViewName());

    Centro centro = (Centro) mav.getModel().get(Constant.CENTRO);
    assertNotNull(centro);
   
    dbCentro.pulisciDb();
    dbCentro = null;
  }
View Full Code Here

  }
 
 
  public void testConferma() throws Exception {

    DBCentri dbCentro = new DBCentri();
    dbCentro.preparaDb();

    _reqMock = new MockHttpServletRequest("GET", "/centri.admin?action=conferma");
    _reqMock.setParameter(Constant.ID, "46");
    ModelAndView mav = _controller.conferma(_reqMock, _resMock);
    assertEquals("admin/confermaEliminazioneCentro", mav.getViewName());

    Centro centro = (Centro) mav.getModel().get(Constant.CENTRO);
    assertNotNull(centro);
   
    dbCentro.pulisciDb();
    dbCentro = null;
  }
View Full Code Here

    dbCentro = null;
  }
 
  public void testElimina() throws Exception {

    DBCentri dbCentro = new DBCentri();
    dbCentro.preparaDb();

    _reqMock = new MockHttpServletRequest("GET", "/centri.admin?action=elimina");
    _reqMock.setParameter(Constant.ID, "46");
    ModelAndView mav = _controller.elimina(_reqMock, _resMock);
    assertEquals(Constant.REDIRECT_ELENCO_CENTRI, mav.getViewName());
   
    dbCentro.pulisciDb();
    dbCentro = null;
  }
View Full Code Here

  }

  @SuppressWarnings("unchecked")
  public void testElenco() throws Exception {

    DBCentri dbCentri = new DBCentri();
    dbCentri.preparaDb();

    _reqMock = new MockHttpServletRequest("GET",
        "/ricercheCentri.admin?action=elenco");
    _reqMock.setParameter(Constant.LETTERA, "c");
    ModelAndView mav = _controller.elenco(_reqMock, _resMock);
    assertEquals("admin/elencoRicercaAlfabeticaCentri", mav.getViewName());
    List centri = (List) mav.getModel().get(Constant.ELENCO_CENTRI);
    assertEquals(2, centri.size());

    dbCentri.pulisciDb();
  }
View Full Code Here

    dbCentri.pulisciDb();
  }

  public void testPrepara() throws Exception {

    DBCentri dbCentri = new DBCentri();
    dbCentri.preparaDb();

    _reqMock = new MockHttpServletRequest("GET",
        "/ricercheCentri.admin?action=prepara");
    ModelAndView mav = _controller.prepara(_reqMock, _resMock);
    assertEquals("admin/ricercaAlfabeticaCentri", mav.getViewName());

    dbCentri.pulisciDb();
  }
View Full Code Here

  }

 
  public void testElenco() throws Exception {

    DBCentri dbCentri = new DBCentri();
    dbCentri.preparaDb();
    DBPages dBPages = new DBPages();
    dBPages.preparaDb();

    _reqMock = new MockHttpServletRequest("GET",
        "/pages.admin?action=elenco");

    ModelAndView mav = _controller.elenco(_reqMock, _resMock);
    assertEquals("admin/elencoPages", mav.getViewName());
    List centri = (List) mav.getModel().get(Constant.ELENCO_PAGES);
    assertEquals(10, centri.size());

    dBPages.pulisciDb();
    dbCentri.pulisciDb();
    dbCentri = null;
    dBPages = null;
  }
View Full Code Here

    dBPages = null;
  }

  public void testCentro() throws Exception {

    DBCentri dbCentri = new DBCentri();
    dbCentri.preparaDb();
    DBPages dBPages = new DBPages();
    dBPages.preparaDb();

    _reqMock = new MockHttpServletRequest("GET",
        "/pages.admin?action=centro");
    _reqMock.getSession().setAttribute(Constant.ID_CENTRO_SESSIONE, 46l);

    ModelAndView mav = _controller.centro(_reqMock, _resMock);
    assertEquals("admin/elencoPages", mav.getViewName());
    List centri = (List) mav.getModel().get(Constant.ELENCO_PAGES);
    assertEquals(7, centri.size());

    dBPages.pulisciDb();
    dbCentri.pulisciDb();
    dBPages = null;
    dbCentri = null;
  }
View Full Code Here

    dbCentri = null;
  }

  public void testAdmin() throws Exception {

    DBCentri dbCentri = new DBCentri();
    dbCentri.preparaDb();
    DBPages dbPages = new DBPages();
    dbPages.preparaDb();

    _reqMock = new MockHttpServletRequest("GET",
        "/pages.admin?action=admin");

    ModelAndView mav = _controller.admin(_reqMock, _resMock);
    assertEquals("admin/elencoPages", mav.getViewName());
    List centri = (List) mav.getModel().get(Constant.ELENCO_PAGES);
    assertEquals(3, centri.size());

    dbPages.pulisciDb();
    dbCentri.pulisciDb();
    dbPages = null;
    dbCentri = null;
  }
View Full Code Here

    db = null;
    dbGruppi = null;
  }

  public void testGetMailgruppi() {
    DBCentri dbC = new DBCentri();
    dbC.preparaDb();
    DBUtenti db = new DBUtenti();
    db.preparaDb();
   
    assertEquals(_service.getMailgruppi("1").size(), 5);
    assertEquals(_service.getMailgruppi("1,2").size(), 8);
    assertEquals(_service.getMailgruppi("1,2,3").size(), 14);
    assertEquals(_service.getMailgruppi("1,2,3,4").size(), 15);
   
    db.pulisciDb();
    dbC.pulisciDb();
    db = null;
    dbC = null;
  }
View Full Code Here

TOP

Related Classes of test.org.magicbox.dbunit.DBCentri

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.