use of io.requery.BlockingEntityStore in project requery by requery.
the class ReactiveTest method testRunInTransaction.
@Test
public void testRunInTransaction() {
final Person person = randomPerson();
data.runInTransaction(new io.requery.util.function.Function<BlockingEntityStore<Persistable>, Boolean>() {
@Override
public Boolean apply(BlockingEntityStore<Persistable> blocking) {
blocking.insert(person);
blocking.update(person);
blocking.delete(person);
return true;
}
}).blockingGet();
assertEquals(0, data.count(Person.class).get().value().intValue());
final Person person2 = randomPerson();
data.runInTransaction(new io.requery.util.function.Function<BlockingEntityStore<Persistable>, Boolean>() {
@Override
public Boolean apply(BlockingEntityStore<Persistable> blocking) {
blocking.insert(person2);
return true;
}
}).blockingGet();
assertEquals(1, data.count(Person.class).get().value().intValue());
}
Aggregations