use of com.pushtorefresh.storio.sqlite.operations.put.PutResult in project storio by pushtorefresh.
the class PutOperationDesignTest method putObjectBlocking.
@Test
public void putObjectBlocking() {
User user = newUser();
PutResult putResult = storIOSQLite().put().object(user).withPutResolver(UserTableMeta.PUT_RESOLVER).prepare().executeAsBlocking();
}
use of com.pushtorefresh.storio.sqlite.operations.put.PutResult in project storio by pushtorefresh.
the class BaseTest method putUserBlocking.
@NonNull
User putUserBlocking(@NonNull final User user) {
final PutResult putResult = storIOSQLite.put().object(user).prepare().executeAsBlocking();
assertThat(putResult).isNotNull();
assertThat(putResult.wasInserted()).isTrue();
return user;
}
use of com.pushtorefresh.storio.sqlite.operations.put.PutResult in project storio by pushtorefresh.
the class UpdateTest method updateUserBlocking.
private void updateUserBlocking(@NonNull final User userForUpdate) {
final PutResult updateResult = storIOSQLite.put().object(userForUpdate).prepare().executeAsBlocking();
assertThat(updateResult.wasUpdated()).isTrue();
}
use of com.pushtorefresh.storio.sqlite.operations.put.PutResult in project storio by pushtorefresh.
the class AutoParcelTest method updateObject.
@Test
public void updateObject() {
final Book book = Book.builder().id(1).title("What a great book").author("Somebody").build();
final PutResult putResult1 = storIOSQLite.put().object(book).prepare().executeAsBlocking();
assertThat(putResult1.wasInserted()).isTrue();
final Book bookWithUpdatedInfo = Book.builder().id(// Same id, should be updated
1).title("Corrected title").author("Corrected author").build();
final PutResult putResult2 = storIOSQLite.put().object(bookWithUpdatedInfo).prepare().executeAsBlocking();
assertThat(putResult2.wasUpdated()).isTrue();
final List<Book> storedBooks = storIOSQLite.get().listOfObjects(Book.class).withQuery(Query.builder().table(BookTableMeta.TABLE).build()).prepare().executeAsBlocking();
assertThat(storedBooks).hasSize(1);
assertThat(storedBooks.get(0)).isEqualTo(bookWithUpdatedInfo);
}
use of com.pushtorefresh.storio.sqlite.operations.put.PutResult in project storio by pushtorefresh.
the class AutoParcelTest method deleteObject.
@Test
public void deleteObject() {
final Book book = Book.builder().id(1).title("What a great book").author("Somebody").build();
final PutResult putResult = storIOSQLite.put().object(book).prepare().executeAsBlocking();
assertThat(putResult.wasInserted()).isTrue();
final DeleteResult deleteResult = storIOSQLite.delete().object(book).prepare().executeAsBlocking();
assertThat(deleteResult.numberOfRowsDeleted()).isEqualTo(1);
final List<Book> storedBooks = storIOSQLite.get().listOfObjects(Book.class).withQuery(Query.builder().table(BookTableMeta.TABLE).build()).prepare().executeAsBlocking();
assertThat(storedBooks).hasSize(0);
}
Aggregations