Examples of DBCentro


Examples of test.org.magicbox.dbunit.DBCentro

    dbCentro.pulisciDb();
  }
 
  public void testWrongFax() {
    DBCentro dbCentro = new DBCentro();
    dbCentro.preparaDb();

    // fax non numerico e di lunghezza insufficiente
    Indirizzo indirizzo = new IndirizzoImpl("09100","cagliari","CA","via casamia 1");
    //use impl only for test
    CentroLightImpl centroLight = new CentroLightImpl();
    centroLight.setCreditoResiduoSms(200);
    centroLight.setId(0);
    centroLight.setNomeCentro("nome");
    centroLight.setNumeroDonatori(300);
    Centro centro = new CentroImpl("http://www.casa.org","070123456","ac","casa@avis.it","descrizione",indirizzo,centroLight);
   
    Errors errors = new BindException(centro, "command");

    _validator.validate(centro, errors);
 
    assertTrue(errors.hasErrors());
    assertTrue(errors.getErrorCount() == 1);

    dbCentro.pulisciDb();
  }
View Full Code Here

Examples of test.org.magicbox.dbunit.DBCentro

    dbCentro.pulisciDb();
  }
 
  public void testWrongEmail() {
    DBCentro dbCentro = new DBCentro();
    dbCentro.preparaDb();

    // email non corretta
    Indirizzo indirizzo = new IndirizzoImpl("09100","cagliari","CA","via casamia 1");
    //use impl only for test
    CentroLightImpl centroLight = new CentroLightImpl();
    centroLight.setCreditoResiduoSms(200);
    centroLight.setId(0);
    centroLight.setNomeCentro("nome");
    centroLight.setNumeroDonatori(300);
    Centro centro = new CentroImpl("http://www.casa.org","070123456","070234567","casaavis.it","descrizione",indirizzo,centroLight);
   
    Errors errors = new BindException(centro, "command");

    _validator.validate(centro, errors);

    assertTrue(errors.hasErrors());
    assertTrue(errors.getErrorCount() == 1);

    assertTrue(errors.hasFieldErrors("email"));

    dbCentro.pulisciDb();
  }
View Full Code Here

Examples of test.org.magicbox.dbunit.DBCentro

    _resMock = new MockHttpServletResponse();
  }

  public void testInsertUtente() throws Exception {

    DBCentro dbCentro = new DBCentro();
    dbCentro.preparaDb();
    DBUtenti dbUtenti = new DBUtenti();

    _reqMock = new MockHttpServletRequest("GET", "/donatore.page");
    _reqMock.getSession().setAttribute(Constant.ID_CENTRO_SESSIONE, 46l);
    RecapitoTelefonico recapitoTel = new RecapitoTelefonicoImpl( "3391234567", "070123456", "", "");
    Indirizzo indirizzo = new IndirizzoImpl( "09100", "Cagliari", "CA",
        "Via casasua 1");
    UtenteLight utenteLight = new UtenteLightImpl("101","pippo",0,2);
    Utente utente = new UtenteImpl(utenteLight,46, "pippo@yahoo.it", true, indirizzo, recapitoTel);
    ModelAndView mav = _controller.onSubmit(_reqMock, _resMock, utente,
        new BindException(utente, Constant.DONOR));
    assertEquals(Constant.REDIRECT_ELENCO_DONORS, mav.getViewName());

    dbUtenti.pulisciDb();
    dbCentro.pulisciDb();
    dbUtenti = null;
    dbCentro = null;
  }
View Full Code Here

Examples of test.org.magicbox.dbunit.DBCentro

    dbCentro.pulisciDb();
  }
 
  public void testWrongCitta() {
    DBCentro dbCentro = new DBCentro();
    dbCentro.preparaDb();

    // nome citt� troppo breve
    Indirizzo indirizzo = new IndirizzoImpl("09100","ca","CA","via casamia 1");
    //use impl only for test
    CentroLightImpl centroLight = new CentroLightImpl();
    centroLight.setCreditoResiduoSms(200);
    centroLight.setId(0);
    centroLight.setNomeCentro("nome");
    centroLight.setNumeroDonatori(300);
    Centro centro = new CentroImpl("http://www.casa.org","070123456","070234567","casa@avis.it","descrizione",indirizzo,centroLight);
   
    Errors errors = new BindException(centro, "command");

    _validator.validate(centro, errors);

    assertTrue(errors.hasErrors());
    assertTrue(errors.getErrorCount() == 1);

    assertTrue(errors.hasFieldErrors("citta"));

    dbCentro.pulisciDb();
  }
View Full Code Here

Examples of test.org.magicbox.dbunit.DBCentro

    dbCentro = null;
  }

  public void testUpdateUtente() throws Exception {

    DBCentro dbCentro = new DBCentro();
    dbCentro.preparaDb();
    DBUtenti dbUtenti = new DBUtenti();

    _reqMock = new MockHttpServletRequest("GET", "/donatore.page");
    _reqMock.getSession().setAttribute(Constant.ID_CENTRO_SESSIONE, 46l);
    RecapitoTelefonico recapitoTel = new RecapitoTelefonicoImpl( "3391234567", "070123456", "", "");
    Indirizzo indirizzo = new IndirizzoImpl( "09100", "Cagliari", "CA",
        "Via casasua 1");
    UtenteLight utenteLight = new UtenteLightImpl("","pippo",0,6667);
    Utente utente = new UtenteImpl(utenteLight,46, "pippo@yahoo.it", true, indirizzo, recapitoTel);

    ModelAndView mav = _controller.onSubmit(_reqMock, _resMock, utente,
        new BindException(utente, Constant.DONOR));
    assertEquals(Constant.REDIRECT_ELENCO_DONORS, mav.getViewName());

    dbUtenti.pulisciDb();
    dbCentro.pulisciDb();
    dbUtenti = null;
    dbCentro = null;
  }
View Full Code Here

Examples of test.org.magicbox.dbunit.DBCentro

    dbCentro.pulisciDb();
  }
 
  public void testWrongCap() {
    DBCentro dbCentro = new DBCentro();
    dbCentro.preparaDb();

    // cap non numerico e troppo breve
    Indirizzo indirizzo = new IndirizzoImpl("ac","cagliari","CA","via casamia 1");
    //use impl only for test
    CentroLightImpl centroLight = new CentroLightImpl();
    centroLight.setCreditoResiduoSms(200);
    centroLight.setId(0);
    centroLight.setNomeCentro("nome");
    centroLight.setNumeroDonatori(300);
    Centro centro = new CentroImpl("http://www.casa.org","070123456","070234567","casa@avis.it","descrizione",indirizzo,centroLight);
   
    Errors errors = new BindException(centro, "command");

    _validator.validate(centro, errors);

    assertTrue(errors.hasErrors());
    assertTrue(errors.getErrorCount() == 1);

    dbCentro.pulisciDb();
  }
View Full Code Here

Examples of test.org.magicbox.dbunit.DBCentro

    dbCentro.pulisciDb();
  }
 
  public void testWrongIndirizzo() {
    DBCentro dbCentro = new DBCentro();
    dbCentro.preparaDb();

    // indirizzo troppo breve
    Indirizzo indirizzo = new IndirizzoImpl("09100","cagliari","CA","via");
    //use impl only for test
    CentroLightImpl centroLight = new CentroLightImpl();
    centroLight.setCreditoResiduoSms(200);
    centroLight.setId(0);
    centroLight.setNomeCentro("nome");
    centroLight.setNumeroDonatori(300);
    Centro centro = new CentroImpl("http://www.casa.org","070123456","070234567","casa@avis.it","descrizione",indirizzo,centroLight);
   
   
    Errors errors = new BindException(centro, "command");

    _validator.validate(centro, errors);

    assertTrue(errors.hasErrors());
    assertTrue(errors.getErrorCount() == 1);

    dbCentro.pulisciDb();
  }
View Full Code Here

Examples of test.org.magicbox.dbunit.DBCentro

    dbCentro.pulisciDb();
  }
 
  public void testWrongNomeCentro() {
    DBCentro dbCentro = new DBCentro();
    dbCentro.preparaDb();

    // nome centro troppo breve
    Indirizzo indirizzo = new IndirizzoImpl("09100","cagliari","CA","via casamia 1");
    //use impl only for test
    CentroLightImpl centroLight = new CentroLightImpl();
    centroLight.setCreditoResiduoSms(200);
    centroLight.setId(0);
    centroLight.setNomeCentro("n");
    centroLight.setNumeroDonatori(300);
    Centro centro = new CentroImpl("http://www.casa.org","070123456","070234567","casa@avis.it","descrizione",indirizzo,centroLight);
   
    Errors errors = new BindException(centro, "command");

    _validator.validate(centro, errors);

    assertTrue(errors.hasErrors());
    assertTrue(errors.getErrorCount() == 1);

    assertTrue(errors.hasFieldErrors("nomeCentro"));

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

Examples of test.org.magicbox.dbunit.DBCentro

    dbCentro.pulisciDb();
    dbCentro = null;
  }*/
 
  public void testWrongProvincia() {
    DBCentro dbCentro = new DBCentro();
    dbCentro.preparaDb();

    // provincia non alfabetica e di lughezza insufficiente
    Indirizzo indirizzo = new IndirizzoImpl("09100","cagliari","1","via casamia 1");
    //use impl only for test
    CentroLightImpl centroLight = new CentroLightImpl();
    centroLight.setCreditoResiduoSms(200);
    centroLight.setId(0);
    centroLight.setNomeCentro("nome centro");
    centroLight.setNumeroDonatori(300);
    Centro centro = new CentroImpl("http://www.casa.org","070123456","070234567","casa@avis.it","descrizione",indirizzo,centroLight);
   
    Errors errors = new BindException(centro, "command");

    _validator.validate(centro, errors);

    assertTrue(errors.hasErrors());
 
    assertTrue(errors.getErrorCount() == 1);

    assertTrue(errors.hasFieldErrors("provincia"));

    dbCentro.pulisciDb();
   
  }
View Full Code Here

Examples of test.org.magicbox.dbunit.DBCentro

    dbCentro.pulisciDb();
   
  }
 
  public void testWrongSitoWeb() {
    DBCentro dbCentro = new DBCentro();
    dbCentro.preparaDb();

    // sito web troppo breve
    Indirizzo indirizzo = new IndirizzoImpl("09100","cagliari","CA","via casamia 1");
    //use impl only for test
    CentroLightImpl centroLight = new CentroLightImpl();
    centroLight.setCreditoResiduoSms(200);
    centroLight.setId(0);
    centroLight.setNomeCentro("nome centro");
    centroLight.setNumeroDonatori(300);
    Centro centro = new CentroImpl("http://","070123456","070234567","casa@avis.it","descrizione",indirizzo,centroLight);
   
    Errors errors = new BindException(centro, "command");

    _validator.validate(centro, errors);

    assertTrue(errors.hasErrors());
 
    assertTrue(errors.getErrorCount() == 1);

    assertTrue(errors.hasFieldErrors("sitoWeb"));

    dbCentro.pulisciDb();
    dbCentro = null;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.