Search in sources :

Example 1 with DeleteResult

use of com.pushtorefresh.storio.sqlite.operations.delete.DeleteResult 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);
}
Also used : PutResult(com.pushtorefresh.storio.sqlite.operations.put.PutResult) DeleteResult(com.pushtorefresh.storio.sqlite.operations.delete.DeleteResult) Test(org.junit.Test)

Example 2 with DeleteResult

use of com.pushtorefresh.storio.sqlite.operations.delete.DeleteResult in project storio by pushtorefresh.

the class DeleteOperationDesignTest method deleteObjectBlocking.

@Test
public void deleteObjectBlocking() {
    User user = newUser();
    DeleteResult deleteResult = storIOSQLite().delete().object(user).withDeleteResolver(UserTableMeta.DELETE_RESOLVER).prepare().executeAsBlocking();
}
Also used : DeleteResult(com.pushtorefresh.storio.sqlite.operations.delete.DeleteResult) Test(org.junit.Test)

Example 3 with DeleteResult

use of com.pushtorefresh.storio.sqlite.operations.delete.DeleteResult in project storio by pushtorefresh.

the class BaseTest method deleteUserBlocking.

@NonNull
DeleteResult deleteUserBlocking(@NonNull final User user) {
    final DeleteResult deleteResult = storIOSQLite.delete().object(user).prepare().executeAsBlocking();
    assertThat(deleteResult.numberOfRowsDeleted()).isEqualTo(1);
    return deleteResult;
}
Also used : DeleteResult(com.pushtorefresh.storio.sqlite.operations.delete.DeleteResult) NonNull(android.support.annotation.NonNull)

Aggregations

DeleteResult (com.pushtorefresh.storio.sqlite.operations.delete.DeleteResult)3 Test (org.junit.Test)2 NonNull (android.support.annotation.NonNull)1 PutResult (com.pushtorefresh.storio.sqlite.operations.put.PutResult)1