avance en los test

This commit is contained in:
Daniel Cortés
2019-04-08 11:41:42 -04:00
parent c8a51cff7f
commit e6b0bfaa27
10 changed files with 337 additions and 31 deletions

View File

@@ -235,6 +235,36 @@ class SQLiteCalculoFondoDAOTest {
.hasSize(0);
}
@Test
void shouldNotInsertWithCajaEMPTY(){
Caja c = Caja.EMPTY;
CalculoFondo f = giveRandomCalculoFondo(c);
this.calculoFondoDAO.insert(f);
List<CalculoFondo> l = this.calculoFondoDAO.getAll();
assertThat(l).hasSize(0);
}
@Test
void shouldNotUpdateWithCajaEMPTY(){
Caja c = giveRandomCaja();
this.cajaDAO.insert(c);
CalculoFondo f1 = giveRandomCalculoFondo(c);
this.calculoFondoDAO.insert(f1);
CalculoFondo f2 = giveRandomCalculoFondo(Caja.EMPTY, f1.getId());
this.calculoFondoDAO.update(f2);
Optional<CalculoFondo> o = this.calculoFondoDAO.getById(f1.getId());
assertThat(o)
.isPresent()
.contains(f1);
}
Caja giveRandomCaja() {
Caja caja = new Caja();
caja.setFondo(faker.number().numberBetween(0, 10000000));