avance en los test
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user