diff --git a/storio-common/src/main/java/com/pushtorefresh/storio2/operations/PreparedOperation.java b/storio-common/src/main/java/com/pushtorefresh/storio2/operations/PreparedOperation.java index cfd8a5f0b..13b952ef2 100644 --- a/storio-common/src/main/java/com/pushtorefresh/storio2/operations/PreparedOperation.java +++ b/storio-common/src/main/java/com/pushtorefresh/storio2/operations/PreparedOperation.java @@ -29,19 +29,6 @@ public interface PreparedOperation { @WorkerThread Result executeAsBlocking(); - /** - * Creates {@link rx.Observable} that emits result of Operation. - *

- * Observable may be "Hot" or "Cold", please read documentation of the concrete implementation. - * - * @return observable result of operation with only one {@link rx.Observer#onNext(Object)} call. - * @deprecated (will be removed in 2.0) please use {@link #asRxObservable()}. - */ - @NonNull - @CheckResult - @Deprecated - Observable createObservable(); - /** * Creates {@link rx.Observable} that emits result of Operation. *

diff --git a/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/StorIOContentResolver.java b/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/StorIOContentResolver.java index 2ae88186d..03e3eb17c 100644 --- a/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/StorIOContentResolver.java +++ b/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/StorIOContentResolver.java @@ -101,18 +101,6 @@ public Observable observeChangesOfUri(@NonNull Uri uri) { @Nullable public abstract Scheduler defaultScheduler(); - /** - * An API for low level interaction with {@link ContentResolver}, it's part of public API, so feel free to use it, - * but please read documentation carefully! - * - * @return implementation of low level APIs for {@link StorIOContentResolver}. - * @deprecated please use {@link #lowLevel()}, this one will be removed in v2.0, - * basically, we just renamed it to LowLevel. - */ - @Deprecated - @NonNull - public abstract Internal internal(); - /** * An API for low level interaction with {@link ContentResolver}, it's part of public API, so feel free to use it, * but please read documentation carefully! @@ -189,13 +177,4 @@ public static abstract class LowLevel { @NonNull public abstract ContentResolver contentResolver(); } - - /** - * @deprecated please use {@link LowLevel} instead, this type will be removed in v2.0, - * basically we're just giving this API a better name. - */ - @Deprecated - public static abstract class Internal extends LowLevel { - - } } diff --git a/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/impl/DefaultStorIOContentResolver.java b/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/impl/DefaultStorIOContentResolver.java index 557d17762..bceda8636 100644 --- a/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/impl/DefaultStorIOContentResolver.java +++ b/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/impl/DefaultStorIOContentResolver.java @@ -43,7 +43,7 @@ public class DefaultStorIOContentResolver extends StorIOContentResolver { @NonNull - private final Internal lowLevel; + private final LowLevel lowLevel; @NonNull private final ContentResolver contentResolver; @@ -87,15 +87,6 @@ public Scheduler defaultScheduler() { return defaultScheduler; } - /** - * {@inheritDoc} - */ - @NonNull - @Override - public Internal internal() { - return lowLevel; - } - /** * {@inheritDoc} */ @@ -252,7 +243,7 @@ public DefaultStorIOContentResolver build() { } } - protected class LowLevelImpl extends Internal { + protected class LowLevelImpl extends LowLevel { @NonNull private final TypeMappingFinder typeMappingFinder; @@ -352,15 +343,4 @@ public ContentResolver contentResolver() { return contentResolver; } } - - /** - * Please use {@link LowLevelImpl} instead, this type will be remove in v2.0. - */ - @Deprecated - protected class InternalImpl extends LowLevelImpl { - - protected InternalImpl(@NonNull TypeMappingFinder typeMappingFinder) { - super(typeMappingFinder); - } - } } diff --git a/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/delete/PreparedDeleteByQuery.java b/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/delete/PreparedDeleteByQuery.java index 4937ea42c..bb5d54e16 100644 --- a/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/delete/PreparedDeleteByQuery.java +++ b/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/delete/PreparedDeleteByQuery.java @@ -56,28 +56,6 @@ public DeleteResult executeAsBlocking() { } } - /** - * Creates {@link Observable} which will perform Delete Operation and send result to observer. - *

- * Returned {@link Observable} will be "Cold Observable", which means that it performs - * delete only after subscribing to it. Also, it emits the result once. - *

- *

- *
Scheduler:
- *
Operates on {@link StorIOContentResolver#defaultScheduler()} if not {@code null}.
- *
- * - * @return non-null {@link Observable} which will perform Delete Operation. - * And send result to observer. - * @deprecated (will be removed in 2.0) please use {@link #asRxObservable()}. - */ - @NonNull - @CheckResult - @Override - public Observable createObservable() { - return asRxObservable(); - } - /** * Creates {@link Observable} which will perform Delete Operation and send result to observer. *

diff --git a/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/delete/PreparedDeleteCollectionOfObjects.java b/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/delete/PreparedDeleteCollectionOfObjects.java index b8b4e38a6..c654b6090 100644 --- a/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/delete/PreparedDeleteCollectionOfObjects.java +++ b/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/delete/PreparedDeleteCollectionOfObjects.java @@ -108,28 +108,6 @@ public DeleteResults executeAsBlocking() { } } - /** - * Creates {@link Observable} which will perform Delete Operation and send result to observer. - *

- * Returned {@link Observable} will be "Cold Observable", which means that it performs - * delete only after subscribing to it. Also, it emits the result once. - *

- *

- *
Scheduler:
- *
Operates on {@link StorIOContentResolver#defaultScheduler()} if not {@code null}.
- *
- * - * @return non-null {@link Observable} which will perform Delete Operation. - * and send result to observer. - * @deprecated (will be removed in 2.0) please use {@link #asRxObservable()}. - */ - @NonNull - @CheckResult - @Override - public Observable> createObservable() { - return asRxObservable(); - } - /** * Creates {@link Observable} which will perform Delete Operation and send result to observer. *

diff --git a/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/delete/PreparedDeleteObject.java b/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/delete/PreparedDeleteObject.java index 82f0a338e..54c4df2e8 100644 --- a/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/delete/PreparedDeleteObject.java +++ b/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/delete/PreparedDeleteObject.java @@ -75,28 +75,6 @@ public DeleteResult executeAsBlocking() { } } - /** - * Creates {@link Observable} which will perform Delete Operation and send result to observer. - *

- * Returned {@link Observable} will be "Cold Observable", which means that it performs - * delete only after subscribing to it. Also, it emits the result once. - *

- *

- *
Scheduler:
- *
Operates on {@link StorIOContentResolver#defaultScheduler()} if not {@code null}.
- *
- * - * @return non-null {@link Observable} which will perform Delete Operation. - * and send result to observer. - * @deprecated (will be removed in 2.0) please use {@link #asRxObservable()}. - */ - @NonNull - @CheckResult - @Override - public Observable createObservable() { - return asRxObservable(); - } - /** * Creates {@link Observable} which will perform Delete Operation and send result to observer. *

diff --git a/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/get/PreparedGetCursor.java b/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/get/PreparedGetCursor.java index 4f50f74c2..a381cfc19 100644 --- a/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/get/PreparedGetCursor.java +++ b/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/get/PreparedGetCursor.java @@ -56,31 +56,6 @@ public Cursor executeAsBlocking() { } } - /** - * Creates "Hot" {@link Observable} which will be subscribed to changes of {@link #query} Uri - * and will emit result each time change occurs. - *

- * First result will be emitted immediately after subscription, - * other emissions will occur only if changes of {@link #query} Uri will occur. - *

- *
Scheduler:
- *
Operates on {@link StorIOContentResolver#defaultScheduler()} if not {@code null}.
- *
- *

- * Please don't forget to unsubscribe from this {@link Observable} because - * it's "Hot" and endless. - * - * @return non-null {@link Observable} which will emit non-null - * list with mapped results and will be subscribed to changes of {@link #query} Uri. - * @deprecated (will be removed in 2.0) please use {@link #asRxObservable()}. - */ - @NonNull - @CheckResult - @Override - public Observable createObservable() { - return asRxObservable(); - } - /** * Creates "Hot" {@link Observable} which will be subscribed to changes of {@link #query} Uri * and will emit result each time change occurs. diff --git a/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/get/PreparedGetListOfObjects.java b/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/get/PreparedGetListOfObjects.java index 171c756af..1947fd72a 100644 --- a/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/get/PreparedGetListOfObjects.java +++ b/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/get/PreparedGetListOfObjects.java @@ -104,33 +104,6 @@ public List executeAsBlocking() { } } - /** - * Creates "Hot" {@link Observable} which will be subscribed to changes of {@link #query} Uri - * and will emit result each time change occurs. - *

- * First result will be emitted immediately after subscription, - * other emissions will occur only if changes of {@link #query} Uri will occur. - *

- *

- *
Scheduler:
- *
Operates on {@link StorIOContentResolver#defaultScheduler()} if not {@code null}.
- *
- *

- * Please don't forget to unsubscribe from this {@link Observable} - * because it's "Hot" and endless. - * - * @return non-null {@link Observable} which will emit non-null, immutable - * {@link List} with mapped results and will be subscribed to changes of {@link #query} Uri, - * list can be empty. - * @deprecated (will be removed in 2.0) please use {@link #asRxObservable()}. - */ - @NonNull - @CheckResult - @Override - public Observable> createObservable() { - return asRxObservable(); - } - /** * Creates "Hot" {@link Observable} which will be subscribed to changes of {@link #query} Uri * and will emit result each time change occurs. diff --git a/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/get/PreparedGetNumberOfResults.java b/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/get/PreparedGetNumberOfResults.java index aacd5c7f7..023eab53d 100644 --- a/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/get/PreparedGetNumberOfResults.java +++ b/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/get/PreparedGetNumberOfResults.java @@ -56,32 +56,6 @@ public Integer executeAsBlocking() { } } - /** - * Creates "Hot" {@link Observable} which will be subscribed to changes of tables from query - * and will emit result each time change occurs. - *

- * First result will be emitted immediately after subscription, - * other emissions will occur only if changes of tables from query will occur during lifetime of - * the {@link Observable}. - *

- *
Scheduler:
- *
Operates on {@link StorIOContentResolver#defaultScheduler()} if not {@code null}.
- *
- *

- * Please don't forget to unsubscribe from this {@link Observable} because - * it's "Hot" and endless. - * - * @return non-null {@link Observable} which will emit non-null - * number of results of the executed query and will be subscribed to changes of tables from query. - * @deprecated (will be removed in 2.0) please use {@link #asRxObservable()}. - */ - @NonNull - @CheckResult - @Override - public Observable createObservable() { - return asRxObservable(); - } - /** * Creates "Hot" {@link Observable} which will be subscribed to changes of tables from query * and will emit result each time change occurs. @@ -220,4 +194,4 @@ public PreparedGetNumberOfResults prepare() { } } -} \ No newline at end of file +} diff --git a/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/get/PreparedGetObject.java b/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/get/PreparedGetObject.java index 723ef7172..b227e1f0c 100644 --- a/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/get/PreparedGetObject.java +++ b/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/get/PreparedGetObject.java @@ -95,33 +95,6 @@ public T executeAsBlocking() { } } - /** - * Creates "Hot" {@link Observable} which will be subscribed to changes of {@link #query} Uri - * and will emit result each time change occurs. - *

- * First result will be emitted immediately after subscription, - * other emissions will occur only if changes of {@link #query} Uri will occur. - *

- *

- *
Scheduler:
- *
Operates on {@link StorIOContentResolver#defaultScheduler()} if not {@code null}.
- *
- *

- * Please don't forget to unsubscribe from this {@link Observable} - * because it's "Hot" and endless. - * - * @return non-null {@link Observable} which will emit single object - * (can be {@code null}, if no items are found) - * with mapped results and will be subscribed to changes of tables from query - * @deprecated (will be removed in 2.0) please use {@link #asRxObservable()}. - */ - @NonNull - @CheckResult - @Override - public Observable createObservable() { - return asRxObservable(); - } - /** * Creates "Hot" {@link Observable} which will be subscribed to changes of {@link #query} Uri * and will emit result each time change occurs. diff --git a/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/put/PreparedPutCollectionOfObjects.java b/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/put/PreparedPutCollectionOfObjects.java index fa6b99b88..91cadc777 100644 --- a/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/put/PreparedPutCollectionOfObjects.java +++ b/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/put/PreparedPutCollectionOfObjects.java @@ -108,28 +108,6 @@ public PutResults executeAsBlocking() { } } - /** - * Creates {@link Observable} which will perform Put Operation and send result to observer. - *

- * Returned {@link Observable} will be "Cold Observable", which means that it performs - * put only after subscribing to it. Also, it emits the result once. - *

- *

- *
Scheduler:
- *
Operates on {@link StorIOContentResolver#defaultScheduler()} if not {@code null}.
- *
- * - * @return non-null {@link Observable} which will perform Put Operation. - * and send result to observer. - * @deprecated (will be removed in 2.0) please use {@link #asRxObservable()}. - */ - @NonNull - @CheckResult - @Override - public Observable> createObservable() { - return asRxObservable(); - } - /** * Creates {@link Observable} which will perform Put Operation and send result to observer. *

diff --git a/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/put/PreparedPutContentValues.java b/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/put/PreparedPutContentValues.java index 02bc2d74f..931923d85 100644 --- a/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/put/PreparedPutContentValues.java +++ b/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/put/PreparedPutContentValues.java @@ -54,28 +54,6 @@ public PutResult executeAsBlocking() { } } - /** - * Creates {@link Observable} which will perform Put Operation and send result to observer. - *

- * Returned {@link Observable} will be "Cold Observable", which means that it performs - * put only after subscribing to it. Also, it emits the result once. - *

- *

- *
Scheduler:
- *
Operates on {@link StorIOContentResolver#defaultScheduler()} if not {@code null}.
- *
- * - * @return non-null {@link Observable} which will perform Put Operation. - * and send result to observer. - * @deprecated (will be removed in 2.0) please use {@link #asRxObservable()}. - */ - @NonNull - @CheckResult - @Override - public Observable createObservable() { - return asRxObservable(); - } - /** * Creates {@link Observable} which will perform Put Operation and send result to observer. *

diff --git a/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/put/PreparedPutContentValuesIterable.java b/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/put/PreparedPutContentValuesIterable.java index 8a38a3c6a..31a7c1695 100644 --- a/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/put/PreparedPutContentValuesIterable.java +++ b/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/put/PreparedPutContentValuesIterable.java @@ -65,28 +65,6 @@ public PutResults executeAsBlocking() { } } - /** - * Creates {@link Observable} which will perform Put Operation and send result to observer. - *

- * Returned {@link Observable} will be "Cold Observable", which means that it performs - * put only after subscribing to it. Also, it emits the result once. - *

- *

- *
Scheduler:
- *
Operates on {@link StorIOContentResolver#defaultScheduler()} if not {@code null}.
- *
- * - * @return non-null {@link Observable} which will perform Put Operation. - * and send result to observer. - * @deprecated (will be removed in 2.0) please use {@link #asRxObservable()}. - */ - @NonNull - @CheckResult - @Override - public Observable> createObservable() { - return asRxObservable(); - } - /** * Creates {@link Observable} which will perform Put Operation and send result to observer. *

@@ -215,4 +193,4 @@ public PreparedPutContentValuesIterable prepare() { ); } } -} \ No newline at end of file +} diff --git a/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/put/PreparedPutObject.java b/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/put/PreparedPutObject.java index fc0fceda7..90a0e2a7c 100644 --- a/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/put/PreparedPutObject.java +++ b/storio-content-resolver/src/main/java/com/pushtorefresh/storio2/contentresolver/operations/put/PreparedPutObject.java @@ -74,28 +74,6 @@ public PutResult executeAsBlocking() { } } - /** - * Creates {@link Observable} which will perform Put Operation and send result to observer. - *

- * Returned {@link Observable} will be "Cold Observable", which means that it performs - * put only after subscribing to it. Also, it emits the result once. - *

- *

- *
Scheduler:
- *
Operates on {@link StorIOContentResolver#defaultScheduler()} if not {@code null}.
- *
- * - * @return non-null {@link Observable} which will perform Put Operation. - * and send result to observer. - * @deprecated (will be removed in 2.0) please use {@link #asRxObservable()}. - */ - @NonNull - @CheckResult - @Override - public Observable createObservable() { - return asRxObservable(); - } - /** * Creates {@link Observable} which will perform Put Operation and send result to observer. *

diff --git a/storio-content-resolver/src/test/java/com/pushtorefresh/storio2/contentresolver/design/DesignTestStorIOContentResolver.java b/storio-content-resolver/src/test/java/com/pushtorefresh/storio2/contentresolver/design/DesignTestStorIOContentResolver.java index 54299b550..f4cbc6e75 100644 --- a/storio-content-resolver/src/test/java/com/pushtorefresh/storio2/contentresolver/design/DesignTestStorIOContentResolver.java +++ b/storio-content-resolver/src/test/java/com/pushtorefresh/storio2/contentresolver/design/DesignTestStorIOContentResolver.java @@ -25,7 +25,7 @@ class DesignTestStorIOContentResolver extends StorIOContentResolver { @NonNull - private final Internal lowLevel = new InternalImpl(); + private final LowLevel lowLevel = new LowLevelImpl(); @NonNull @Override @@ -39,19 +39,13 @@ public Scheduler defaultScheduler() { return null; } - @NonNull - @Override - public Internal internal() { - return lowLevel; - } - @NonNull @Override public LowLevel lowLevel() { return lowLevel; } - private class InternalImpl extends Internal { + private class LowLevelImpl extends LowLevel { @Nullable @Override diff --git a/storio-content-resolver/src/test/java/com/pushtorefresh/storio2/contentresolver/impl/DefaultStorIOContentResolverTest.java b/storio-content-resolver/src/test/java/com/pushtorefresh/storio2/contentresolver/impl/DefaultStorIOContentResolverTest.java index 954b6f05c..1afc8a8b7 100644 --- a/storio-content-resolver/src/test/java/com/pushtorefresh/storio2/contentresolver/impl/DefaultStorIOContentResolverTest.java +++ b/storio-content-resolver/src/test/java/com/pushtorefresh/storio2/contentresolver/impl/DefaultStorIOContentResolverTest.java @@ -242,7 +242,7 @@ private static TypeMappingFinder getTypeMappingFinder(@NonNull DefaultStorIOCont class TestDefaultStorIOContentResolver extends DefaultStorIOContentResolver { - private final Internal internal; + private final LowLevel lowLevel; TestDefaultStorIOContentResolver( @NonNull ContentResolver contentResolver, @@ -250,14 +250,14 @@ class TestDefaultStorIOContentResolver extends DefaultStorIOContentResolver { @NonNull TypeMappingFinder typeMappingFinder ) { super(contentResolver, contentObserverHandler, typeMappingFinder, null); - internal = new InternalImpl(typeMappingFinder); + lowLevel = new LowLevelImpl(typeMappingFinder); } @Nullable TypeMappingFinder typeMappingFinder() throws NoSuchFieldException, IllegalAccessException { Field field = DefaultStorIOContentResolver.LowLevelImpl.class.getDeclaredField("typeMappingFinder"); field.setAccessible(true); - return (TypeMappingFinder) field.get(internal); + return (TypeMappingFinder) field.get(lowLevel); } } diff --git a/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/StorIOSQLite.java b/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/StorIOSQLite.java index ff677385f..68dd64fb6 100644 --- a/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/StorIOSQLite.java +++ b/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/StorIOSQLite.java @@ -208,18 +208,6 @@ public Observable observeChangesOfTag(@NonNull String tag) { @Nullable public abstract Scheduler defaultScheduler(); - /** - * An API for low level interaction with DB, it's part of public API, so feel free to use it, - * but please read documentation carefully! - * - * @return implementation of low level APIs for {@link StorIOSQLite}. - * @deprecated please use {@link #lowLevel()}, this one will be removed in v2.0, - * basically, we just renamed it to LowLevel. - */ - @Deprecated - @NonNull - public abstract Internal internal(); - /** * An API for low level interaction with DB, it's part of public API, so feel free to use it, * but please read documentation carefully! @@ -406,13 +394,4 @@ public static abstract class LowLevel { public abstract SQLiteOpenHelper sqliteOpenHelper(); } - - /** - * @deprecated please use {@link LowLevel} instead, this type will be removed in v2.0, - * basically we're just giving this API a better name. - */ - @Deprecated - public static abstract class Internal extends LowLevel { - - } } diff --git a/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/impl/DefaultStorIOSQLite.java b/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/impl/DefaultStorIOSQLite.java index 9d2f25a99..e44abcf45 100644 --- a/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/impl/DefaultStorIOSQLite.java +++ b/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/impl/DefaultStorIOSQLite.java @@ -64,7 +64,7 @@ public class DefaultStorIOSQLite extends StorIOSQLite { * Implementation of {@link com.pushtorefresh.storio2.sqlite.StorIOSQLite.LowLevel}. */ @NonNull - private final Internal lowLevel; + private final LowLevel lowLevel; protected DefaultStorIOSQLite( @NonNull SQLiteOpenHelper sqLiteOpenHelper, @@ -120,16 +120,6 @@ public Scheduler defaultScheduler() { return defaultScheduler; } - /** - * {@inheritDoc} - */ - @NonNull - @Override - @Deprecated - public Internal internal() { - return lowLevel; - } - /** * {@inheritDoc} */ @@ -306,7 +296,7 @@ public DefaultStorIOSQLite build() { /** * {@inheritDoc} */ - protected class LowLevelImpl extends Internal { + protected class LowLevelImpl extends LowLevel { @NonNull private final Object lock = new Object(); @@ -607,15 +597,4 @@ public SQLiteOpenHelper sqliteOpenHelper() { return sqLiteOpenHelper; } } - - /** - * Please use {@link LowLevelImpl} instead, this type will be remove in v2.0. - */ - @Deprecated - protected class InternalImpl extends LowLevelImpl { - - protected InternalImpl(@NonNull TypeMappingFinder typeMappingFinder) { - super(typeMappingFinder); - } - } } diff --git a/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/delete/PreparedDeleteByQuery.java b/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/delete/PreparedDeleteByQuery.java index 502852cbd..7f367f7be 100644 --- a/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/delete/PreparedDeleteByQuery.java +++ b/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/delete/PreparedDeleteByQuery.java @@ -33,28 +33,6 @@ public class PreparedDeleteByQuery extends PreparedDelete - * Returned {@link Observable} will be "Cold Observable", which means that it performs - * delete only after subscribing to it. Also, it emits the result once. - *

- *

- *
Scheduler:
- *
Operates on {@link StorIOSQLite#defaultScheduler()} if not {@code null}.
- *
- * - * @return non-null {@link Observable} which will perform Delete Operation. - * and send result to observer. - * @deprecated (will be removed in 2.0) please use {@link #asRxObservable()}. - */ - @NonNull - @CheckResult - @Override - public Observable createObservable() { - return asRxObservable(); - } - /** * Creates {@link Observable} which will perform Delete Operation and send result to observer. *

diff --git a/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/delete/PreparedDeleteCollectionOfObjects.java b/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/delete/PreparedDeleteCollectionOfObjects.java index a2fd9dcd3..aa543d2b5 100644 --- a/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/delete/PreparedDeleteCollectionOfObjects.java +++ b/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/delete/PreparedDeleteCollectionOfObjects.java @@ -50,28 +50,6 @@ public class PreparedDeleteCollectionOfObjects extends PreparedDelete - * Returned {@link Observable} will be "Cold Observable", which means that it performs - * delete only after subscribing to it. Also, it emits the result once. - *

- *

- *
Scheduler:
- *
Operates on {@link StorIOSQLite#defaultScheduler()} if not {@code null}.
- *
- * - * @return non-null {@link Observable} which will perform Delete Operation. - * and send result to observer. - * @deprecated (will be removed in 2.0) please use {@link #asRxObservable()}. - */ - @NonNull - @CheckResult - @Override - public Observable> createObservable() { - return asRxObservable(); - } - /** * Creates {@link Observable} which will perform Delete Operation and send result to observer. *

diff --git a/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/delete/PreparedDeleteObject.java b/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/delete/PreparedDeleteObject.java index e2c89de82..ce420f83d 100644 --- a/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/delete/PreparedDeleteObject.java +++ b/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/delete/PreparedDeleteObject.java @@ -37,28 +37,6 @@ public class PreparedDeleteObject extends PreparedDelete { this.explicitDeleteResolver = explicitDeleteResolver; } - /** - * Creates {@link Observable} which will perform Delete Operation and send result to observer. - *

- * Returned {@link Observable} will be "Cold Observable", which means that it performs - * delete only after subscribing to it. Also, it emits the result once. - *

- *

- *
Scheduler:
- *
Operates on {@link StorIOSQLite#defaultScheduler()} if not {@code null}.
- *
- * - * @return non-null {@link Observable} which will perform Delete Operation. - * and send result to observer. - * @deprecated (will be removed in 2.0) please use {@link #asRxObservable()}. - */ - @NonNull - @CheckResult - @Override - public Observable createObservable() { - return asRxObservable(); - } - /** * Creates {@link Observable} which will perform Delete Operation and send result to observer. *

diff --git a/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/execute/PreparedExecuteSQL.java b/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/execute/PreparedExecuteSQL.java index 526f84301..3f4197ba5 100644 --- a/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/execute/PreparedExecuteSQL.java +++ b/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/execute/PreparedExecuteSQL.java @@ -55,32 +55,6 @@ public Object executeAsBlocking() { .proceed(this); } - /** - * Creates {@link Observable} which will perform Execute SQL Operation - * and send result to observer. - *

- * Returned {@link Observable} will be "Cold Observable", which means that it performs - * execution of SQL only after subscribing to it. Also, it emits the result once. - *

- *

- *
Scheduler:
- *
Operates on {@link StorIOSQLite#defaultScheduler()} if not {@code null}.
- *
- * - * @return non-null {@link Observable} which will perform Delete Operation - * and send result to observer. Result: just a new instance of {@link Object}, - * actually Execute SQL should return {@code void}, - * but we can not return instance of {@link Void} so we just return {@link Object} - * and you don't have to deal with {@code null}. - * @deprecated (will be removed in 2.0) please use {@link #asRxObservable()}. - */ - @NonNull - @CheckResult - @Override - public Observable createObservable() { - return asRxObservable(); - } - /** * Creates {@link Observable} which will perform Execute SQL Operation * and send result to observer. diff --git a/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/get/PreparedGetCursor.java b/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/get/PreparedGetCursor.java index a71281b69..e8d8d9a31 100644 --- a/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/get/PreparedGetCursor.java +++ b/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/get/PreparedGetCursor.java @@ -47,32 +47,6 @@ public class PreparedGetCursor extends PreparedGet { this.getResolver = getResolver; } - /** - * Creates "Hot" {@link Observable} which will be subscribed to changes of tables from query - * and will emit result each time change occurs. - *

- * First result will be emitted immediately after subscription, - * other emissions will occur only if changes of tables from query will occur during lifetime of - * the {@link Observable}. - *

- *
Scheduler:
- *
Operates on {@link StorIOSQLite#defaultScheduler()} if not {@code null}.
- *
- *

- * Please don't forget to unsubscribe from this {@link Observable} because - * it's "Hot" and endless. - * - * @return non-null {@link Observable} which will emit non-null - * list with mapped results and will be subscribed to changes of tables from query. - * @deprecated (will be removed in 2.0) please use {@link #asRxObservable()}. - */ - @NonNull - @CheckResult - @Override - public Observable createObservable() { - return asRxObservable(); - } - /** * Creates "Hot" {@link Observable} which will be subscribed to changes of tables from query * and will emit result each time change occurs. diff --git a/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/get/PreparedGetListOfObjects.java b/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/get/PreparedGetListOfObjects.java index 94dc45949..0d9cb8fd0 100644 --- a/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/get/PreparedGetListOfObjects.java +++ b/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/get/PreparedGetListOfObjects.java @@ -61,33 +61,6 @@ public class PreparedGetListOfObjects extends PreparedGet> { this.explicitGetResolver = explicitGetResolver; } - /** - * Creates "Hot" {@link Observable} which will be subscribed to changes of tables from query - * and will emit result each time change occurs. - *

- * First result will be emitted immediately after subscription, - * other emissions will occur only if changes of tables from query will occur during lifetime of - * the {@link Observable}. - *

- *
Scheduler:
- *
Operates on {@link StorIOSQLite#defaultScheduler()} if not {@code null}.
- *
- *

- * Please don't forget to unsubscribe from this {@link Observable} because - * it's "Hot" and endless. - * - * @return non-null {@link Observable} which will emit non-null, immutable - * {@link List} with mapped results and will be subscribed to changes of tables from query, - * list can be empty. - * @deprecated (will be removed in 2.0) please use {@link #asRxObservable()}. - */ - @NonNull - @CheckResult - @Override - public Observable> createObservable() { - return asRxObservable(); - } - /** * Creates "Hot" {@link Observable} which will be subscribed to changes of tables from query * and will emit result each time change occurs. @@ -344,4 +317,4 @@ public PreparedGetListOfObjects prepare() { } } } -} \ No newline at end of file +} diff --git a/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/get/PreparedGetNumberOfResults.java b/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/get/PreparedGetNumberOfResults.java index 4584a8978..cf22627a6 100644 --- a/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/get/PreparedGetNumberOfResults.java +++ b/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/get/PreparedGetNumberOfResults.java @@ -40,31 +40,6 @@ public class PreparedGetNumberOfResults extends PreparedGet { this.getResolver = getResolver; } - /** - * Creates "Hot" {@link Observable} which will be subscribed to changes of tables from query - * and will emit result each time change occurs. - *

- * First result will be emitted immediately after subscription, - * other emissions will occur only if changes of tables from query will occur during lifetime of - * the {@link Observable}. - *

- *
Scheduler:
- *
Operates on {@link StorIOSQLite#defaultScheduler()} if not {@code null}.
- *
- *

- * Please don't forget to unsubscribe from this {@link Observable} because - * it's "Hot" and endless. - * - * @return non-null {@link Observable} which will emit non-null - * number of results of the executed query and will be subscribed to changes of tables from query. - * @deprecated (will be removed in 2.0) please use {@link #asRxObservable()}. - */ - @NonNull - @Override - public Observable createObservable() { - return asRxObservable(); - } - /** * Creates "Hot" {@link Observable} which will be subscribed to changes of tables from query * and will emit result each time change occurs. @@ -287,4 +262,4 @@ public PreparedGetNumberOfResults prepare() { } } -} \ No newline at end of file +} diff --git a/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/get/PreparedGetObject.java b/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/get/PreparedGetObject.java index 7a33125e9..e0f8f4989 100644 --- a/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/get/PreparedGetObject.java +++ b/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/get/PreparedGetObject.java @@ -52,33 +52,6 @@ public class PreparedGetObject extends PreparedGet { this.explicitGetResolver = explicitGetResolver; } - /** - * Creates "Hot" {@link Observable} which will be subscribed to changes of tables from query - * and will emit result each time change occurs. - *

- * First result will be emitted immediately after subscription, - * other emissions will occur only if changes of tables from query will occur during lifetime of - * the {@link Observable}. - *

- *
Scheduler:
- *
Operates on {@link StorIOSQLite#defaultScheduler()} if not {@code null}.
- *
- *

- * Please don't forget to unsubscribe from this {@link Observable} because - * it's "Hot" and endless. - * - * @return non-null {@link Observable} which will emit single object - * (can be {@code null}, if no items are found) - * with mapped results and will be subscribed to changes of tables from query - * @deprecated (will be removed in 2.0) please use {@link #asRxObservable()}. - */ - @NonNull - @CheckResult - @Override - public Observable createObservable() { - return asRxObservable(); - } - /** * Creates "Hot" {@link Observable} which will be subscribed to changes of tables from query * and will emit result each time change occurs. diff --git a/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/put/PreparedPutCollectionOfObjects.java b/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/put/PreparedPutCollectionOfObjects.java index fc946549d..76b5b049d 100644 --- a/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/put/PreparedPutCollectionOfObjects.java +++ b/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/put/PreparedPutCollectionOfObjects.java @@ -45,28 +45,6 @@ public class PreparedPutCollectionOfObjects extends PreparedPut this.explicitPutResolver = explicitPutResolver; } - /** - * Creates {@link Observable} which will perform Put Operation and send result to observer. - *

- * Returned {@link Observable} will be "Cold Observable", which means that it performs - * put only after subscribing to it. Also, it emits the result once. - *

- *

- *
Scheduler:
- *
Operates on {@link StorIOSQLite#defaultScheduler()} if not {@code null}.
- *
- * - * @return non-null {@link Observable} which will perform Put Operation. - * and send result to observer. - * @deprecated (will be removed in 2.0) please use {@link #asRxObservable()}. - */ - @NonNull - @CheckResult - @Override - public Observable> createObservable() { - return asRxObservable(); - } - /** * Creates {@link Observable} which will perform Put Operation and send result to observer. *

diff --git a/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/put/PreparedPutContentValues.java b/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/put/PreparedPutContentValues.java index 570e4ce53..85231024e 100644 --- a/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/put/PreparedPutContentValues.java +++ b/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/put/PreparedPutContentValues.java @@ -34,28 +34,6 @@ public class PreparedPutContentValues extends PreparedPut - * Returned {@link Observable} will be "Cold Observable", which means that it performs - * put only after subscribing to it. Also, it emits the result once. - *

- *

- *
Scheduler:
- *
Operates on {@link StorIOSQLite#defaultScheduler()} if not {@code null}.
- *
- * - * @return non-null {@link Observable} which will perform Put Operation. - * and send result to observer. - * @deprecated (will be removed in 2.0) please use {@link #asRxObservable()}. - */ - @NonNull - @CheckResult - @Override - public Observable createObservable() { - return asRxObservable(); - } - /** * Creates {@link Observable} which will perform Put Operation and send result to observer. *

diff --git a/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/put/PreparedPutContentValuesIterable.java b/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/put/PreparedPutContentValuesIterable.java index 8fe9623b1..d1ff0be0e 100644 --- a/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/put/PreparedPutContentValuesIterable.java +++ b/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/put/PreparedPutContentValuesIterable.java @@ -44,28 +44,6 @@ public class PreparedPutContentValuesIterable extends PreparedPut - * Returned {@link Observable} will be "Cold Observable", which means that it performs - * put only after subscribing to it. Also, it emits the result once. - *

- *

- *
Scheduler:
- *
Operates on {@link StorIOSQLite#defaultScheduler()} if not {@code null}.
- *
- * - * @return non-null {@link Observable} which will perform Put Operation. - * and send result to observer. - * @deprecated (will be removed in 2.0) please use {@link #asRxObservable()}. - */ - @NonNull - @CheckResult - @Override - public Observable> createObservable() { - return asRxObservable(); - } - /** * Creates {@link Observable} which will perform Put Operation and send result to observer. *

diff --git a/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/put/PreparedPutObject.java b/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/put/PreparedPutObject.java index ce7f9bbb7..543ff4c75 100644 --- a/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/put/PreparedPutObject.java +++ b/storio-sqlite/src/main/java/com/pushtorefresh/storio2/sqlite/operations/put/PreparedPutObject.java @@ -37,28 +37,6 @@ public class PreparedPutObject extends PreparedPut { this.explicitPutResolver = explicitPutResolver; } - /** - * Creates {@link Observable} which will perform Put Operation and send result to observer. - *

- * Returned {@link Observable} will be "Cold Observable", which means that it performs - * put only after subscribing to it. Also, it emits the result once. - *

- *

- *
Scheduler:
- *
Operates on {@link StorIOSQLite#defaultScheduler()} if not {@code null}.
- *
- * - * @return non-null {@link Observable} which will perform Put Operation. - * and send result to observer. - * @deprecated (will be removed in 2.0) please use {@link #asRxObservable()}. - */ - @NonNull - @CheckResult - @Override - public Observable createObservable() { - return asRxObservable(); - } - /** * Creates {@link Observable} which will perform Put Operation and send result to observer. *

diff --git a/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/LoggingInterceptorTest.java b/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/LoggingInterceptorTest.java index 7aa5e0758..115969fad 100644 --- a/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/LoggingInterceptorTest.java +++ b/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/LoggingInterceptorTest.java @@ -121,12 +121,6 @@ public String executeAsBlocking() { throw new NotImplementedException(); } - @NonNull - @Override - public Observable createObservable() { - throw new NotImplementedException(); - } - @NonNull @Override public Observable asRxObservable() { @@ -145,4 +139,4 @@ public String getData() { return data; } } -} \ No newline at end of file +} diff --git a/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/design/DesignTestStorIOSQLite.java b/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/design/DesignTestStorIOSQLite.java index abf0b22d9..2be279c57 100644 --- a/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/design/DesignTestStorIOSQLite.java +++ b/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/design/DesignTestStorIOSQLite.java @@ -33,7 +33,7 @@ class DesignTestStorIOSQLite extends StorIOSQLite { @NonNull - private final Internal lowLevel = new Internal() { + private final LowLevel lowLevel = new LowLevel() { @Nullable @Override @@ -156,12 +156,6 @@ public PreparedDelete.Builder delete() { return new PreparedDelete.Builder(this); } - @NonNull - @Override - public Internal internal() { - return lowLevel; - } - @NonNull @Override public LowLevel lowLevel() { diff --git a/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/impl/DefaultStorIOSQLiteTest.java b/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/impl/DefaultStorIOSQLiteTest.java index 582f27a30..efecddf66 100644 --- a/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/impl/DefaultStorIOSQLiteTest.java +++ b/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/impl/DefaultStorIOSQLiteTest.java @@ -547,11 +547,6 @@ public void deprecatedInternalImplShouldReturnSentToConstructorTypeMapping() thr assertThat(storIOSQLite.typeMappingFinder()).isSameAs(typeMappingFinder); } - @Test - public void internalShouldReturnLowLevel() { - assertThat(storIOSQLite.internal()).isSameAs(storIOSQLite.lowLevel()); - } - @Test public void defaultSchedulerReturnsIOSchedulerIfNotSpecified() { assertThat(storIOSQLite.defaultScheduler()).isSameAs(io()); @@ -605,18 +600,18 @@ private static void setChangesBus(@NonNull DefaultStorIOSQLite storIOSQLite, @No } class TestDefaultStorIOSQLite extends DefaultStorIOSQLite { - private final Internal internal; + private final LowLevel lowLevel; TestDefaultStorIOSQLite(@NonNull SQLiteOpenHelper sqLiteOpenHelper, @NonNull TypeMappingFinder typeMappingFinder) { super(sqLiteOpenHelper, typeMappingFinder, null, Collections.emptyList()); - internal = new InternalImpl(typeMappingFinder); + lowLevel = new LowLevelImpl(typeMappingFinder); } @Nullable TypeMappingFinder typeMappingFinder() throws NoSuchFieldException, IllegalAccessException { Field field = TestDefaultStorIOSQLite.LowLevelImpl.class.getDeclaredField("typeMappingFinder"); field.setAccessible(true); - return (TypeMappingFinder) field.get(internal); + return (TypeMappingFinder) field.get(lowLevel); } } } diff --git a/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/delete/PreparedDeleteByQueryTest.java b/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/delete/PreparedDeleteByQueryTest.java index 7724574ad..03db2a8ea 100644 --- a/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/delete/PreparedDeleteByQueryTest.java +++ b/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/delete/PreparedDeleteByQueryTest.java @@ -8,17 +8,14 @@ import org.junit.Test; -import rx.Observable; import rx.observers.TestSubscriber; -import static org.assertj.core.api.Java6Assertions.assertThat; import static org.assertj.core.api.Assertions.failBecauseExceptionWasNotThrown; +import static org.assertj.core.api.Java6Assertions.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Matchers.same; -import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; -import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; @@ -29,14 +26,14 @@ private class DeleteByQueryStub { final StorIOSQLite storIOSQLite; final DeleteQuery deleteQuery; final DeleteResolver deleteResolver; - final StorIOSQLite.Internal internal; + final StorIOSQLite.LowLevel lowLevel; final DeleteResult expectedDeleteResult; private DeleteByQueryStub() { storIOSQLite = mock(StorIOSQLite.class); - internal = mock(StorIOSQLite.Internal.class); + lowLevel = mock(StorIOSQLite.LowLevel.class); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); deleteQuery = DeleteQuery.builder() .table("test_table") @@ -58,8 +55,8 @@ void verifyBehaviour() { verify(storIOSQLite).lowLevel(); verify(storIOSQLite).interceptors(); verify(deleteResolver).performDelete(same(storIOSQLite), same(deleteQuery)); - verify(internal).notifyAboutChanges(Changes.newInstance(deleteQuery.table(), deleteQuery.affectsTags())); - verifyNoMoreInteractions(storIOSQLite, internal, deleteResolver); + verify(lowLevel).notifyAboutChanges(Changes.newInstance(deleteQuery.table(), deleteQuery.affectsTags())); + verifyNoMoreInteractions(storIOSQLite, lowLevel, deleteResolver); } } @@ -148,9 +145,9 @@ public void shouldPerformDeletionByQueryCompletable() { @Test public void shouldWrapExceptionIntoStorIOExceptionBlocking() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); //noinspection unchecked final DeleteResolver deleteResolver = mock(DeleteResolver.class); @@ -171,16 +168,16 @@ public void shouldWrapExceptionIntoStorIOExceptionBlocking() { verify(deleteResolver).performDelete(same(storIOSQLite), any(DeleteQuery.class)); verify(storIOSQLite).interceptors(); - verifyNoMoreInteractions(storIOSQLite, internal, deleteResolver); + verifyNoMoreInteractions(storIOSQLite, lowLevel, deleteResolver); } } @Test public void shouldWrapExceptionIntoStorIOExceptionObservable() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); //noinspection unchecked final DeleteResolver deleteResolver = mock(DeleteResolver.class); @@ -209,15 +206,15 @@ public void shouldWrapExceptionIntoStorIOExceptionObservable() { verify(deleteResolver).performDelete(same(storIOSQLite), any(DeleteQuery.class)); verify(storIOSQLite).defaultScheduler(); verify(storIOSQLite).interceptors(); - verifyNoMoreInteractions(storIOSQLite, internal, deleteResolver); + verifyNoMoreInteractions(storIOSQLite, lowLevel, deleteResolver); } @Test public void shouldWrapExceptionIntoStorIOExceptionSingle() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); //noinspection unchecked final DeleteResolver deleteResolver = mock(DeleteResolver.class); @@ -246,15 +243,15 @@ public void shouldWrapExceptionIntoStorIOExceptionSingle() { verify(deleteResolver).performDelete(same(storIOSQLite), any(DeleteQuery.class)); verify(storIOSQLite).defaultScheduler(); verify(storIOSQLite).interceptors(); - verifyNoMoreInteractions(storIOSQLite, internal, deleteResolver); + verifyNoMoreInteractions(storIOSQLite, lowLevel, deleteResolver); } @Test public void shouldWrapExceptionIntoStorIOExceptionCompletable() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); //noinspection unchecked final DeleteResolver deleteResolver = mock(DeleteResolver.class); @@ -283,15 +280,15 @@ public void shouldWrapExceptionIntoStorIOExceptionCompletable() { verify(storIOSQLite).defaultScheduler(); verify(deleteResolver).performDelete(same(storIOSQLite), any(DeleteQuery.class)); verify(storIOSQLite).interceptors(); - verifyNoMoreInteractions(storIOSQLite, internal, deleteResolver); + verifyNoMoreInteractions(storIOSQLite, lowLevel, deleteResolver); } @Test public void shouldNotNotifyIfWasNotDeleted() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); final DeleteQuery deleteQuery = DeleteQuery.builder() .table("test_table") @@ -315,9 +312,9 @@ public void shouldNotNotifyIfWasNotDeleted() { assertThat(actualDeleteResult).isEqualTo(expectedDeleteResult); verify(deleteResolver).performDelete(same(storIOSQLite), same(deleteQuery)); - verify(internal, never()).notifyAboutChanges(any(Changes.class)); + verify(lowLevel, never()).notifyAboutChanges(any(Changes.class)); verify(storIOSQLite).interceptors(); - verifyNoMoreInteractions(storIOSQLite, internal, deleteResolver); + verifyNoMoreInteractions(storIOSQLite, lowLevel, deleteResolver); } @Test @@ -355,24 +352,4 @@ public void deleteByQueryCompletableExecutesOnSpecifiedScheduler() { schedulerChecker.checkAsCompletable(operation); } - - @Test - public void createObservableReturnsAsRxObservable() { - final DeleteByQueryStub stub = new DeleteByQueryStub(); - - PreparedDeleteByQuery preparedOperation = - spy(new PreparedDeleteByQuery.Builder(stub.storIOSQLite, stub.deleteQuery) - .withDeleteResolver(stub.deleteResolver) - .prepare()); - - Observable observable = Observable.just(DeleteResult.newInstance(1, TestItem.TABLE)); - //noinspection CheckResult - doReturn(observable).when(preparedOperation).asRxObservable(); - - //noinspection deprecation - assertThat(preparedOperation.createObservable()).isEqualTo(observable); - - //noinspection CheckResult - verify(preparedOperation).asRxObservable(); - } } diff --git a/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/delete/PreparedDeleteCollectionOfObjectsTest.java b/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/delete/PreparedDeleteCollectionOfObjectsTest.java index 70829b81a..81e47a782 100644 --- a/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/delete/PreparedDeleteCollectionOfObjectsTest.java +++ b/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/delete/PreparedDeleteCollectionOfObjectsTest.java @@ -10,7 +10,6 @@ import org.junit.runner.RunWith; import java.util.Collection; -import java.util.Collections; import java.util.List; import rx.Completable; @@ -20,14 +19,12 @@ import static java.util.Arrays.asList; import static java.util.Collections.singletonList; -import static org.assertj.core.api.Java6Assertions.assertThat; import static org.assertj.core.api.Assertions.failBecauseExceptionWasNotThrown; +import static org.assertj.core.api.Java6Assertions.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Matchers.same; -import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; -import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; @@ -356,9 +353,9 @@ public static class NoTypeMappingError { @Test public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutTransactionWithoutAffectingDbBlocking() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); when(storIOSQLite.delete()).thenReturn(new PreparedDelete.Builder(storIOSQLite)); @@ -381,17 +378,17 @@ public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutTransactionWithout verify(storIOSQLite).delete(); verify(storIOSQLite).interceptors(); verify(storIOSQLite).lowLevel(); - verify(internal).typeMapping(TestItem.class); - verify(internal, never()).delete(any(DeleteQuery.class)); - verifyNoMoreInteractions(storIOSQLite, internal); + verify(lowLevel).typeMapping(TestItem.class); + verify(lowLevel, never()).delete(any(DeleteQuery.class)); + verifyNoMoreInteractions(storIOSQLite, lowLevel); } @Test public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutTransactionWithoutAffectingDbAsObservable() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); when(storIOSQLite.delete()).thenReturn(new PreparedDelete.Builder(storIOSQLite)); @@ -417,17 +414,17 @@ public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutTransactionWithout verify(storIOSQLite).interceptors(); verify(storIOSQLite).lowLevel(); verify(storIOSQLite).defaultScheduler(); - verify(internal).typeMapping(TestItem.class); - verify(internal, never()).delete(any(DeleteQuery.class)); - verifyNoMoreInteractions(storIOSQLite, internal); + verify(lowLevel).typeMapping(TestItem.class); + verify(lowLevel, never()).delete(any(DeleteQuery.class)); + verifyNoMoreInteractions(storIOSQLite, lowLevel); } @Test public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutTransactionWithoutAffectingDbAsSingle() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); when(storIOSQLite.delete()).thenReturn(new PreparedDelete.Builder(storIOSQLite)); @@ -453,17 +450,17 @@ public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutTransactionWithout verify(storIOSQLite).interceptors(); verify(storIOSQLite).lowLevel(); verify(storIOSQLite).defaultScheduler(); - verify(internal).typeMapping(TestItem.class); - verify(internal, never()).delete(any(DeleteQuery.class)); - verifyNoMoreInteractions(storIOSQLite, internal); + verify(lowLevel).typeMapping(TestItem.class); + verify(lowLevel, never()).delete(any(DeleteQuery.class)); + verifyNoMoreInteractions(storIOSQLite, lowLevel); } @Test public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutTransactionWithoutAffectingDbAsCompletable() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); when(storIOSQLite.delete()).thenReturn(new PreparedDelete.Builder(storIOSQLite)); @@ -489,17 +486,17 @@ public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutTransactionWithout verify(storIOSQLite).interceptors(); verify(storIOSQLite).lowLevel(); verify(storIOSQLite).defaultScheduler(); - verify(internal).typeMapping(TestItem.class); - verify(internal, never()).delete(any(DeleteQuery.class)); - verifyNoMoreInteractions(storIOSQLite, internal); + verify(lowLevel).typeMapping(TestItem.class); + verify(lowLevel, never()).delete(any(DeleteQuery.class)); + verifyNoMoreInteractions(storIOSQLite, lowLevel); } @Test public void shouldThrowExceptionIfNoTypeMappingWasFoundWithTransactionWithoutAffectingDbBlocking() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); when(storIOSQLite.delete()).thenReturn(new PreparedDelete.Builder(storIOSQLite)); @@ -522,17 +519,17 @@ public void shouldThrowExceptionIfNoTypeMappingWasFoundWithTransactionWithoutAff verify(storIOSQLite).delete(); verify(storIOSQLite).interceptors(); verify(storIOSQLite).lowLevel(); - verify(internal).typeMapping(TestItem.class); - verify(internal, never()).delete(any(DeleteQuery.class)); - verifyNoMoreInteractions(storIOSQLite, internal); + verify(lowLevel).typeMapping(TestItem.class); + verify(lowLevel, never()).delete(any(DeleteQuery.class)); + verifyNoMoreInteractions(storIOSQLite, lowLevel); } @Test public void shouldThrowExceptionIfNoTypeMappingWasFoundWithTransactionWithoutAffectingDbAsObservable() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); when(storIOSQLite.delete()).thenReturn(new PreparedDelete.Builder(storIOSQLite)); @@ -558,17 +555,17 @@ public void shouldThrowExceptionIfNoTypeMappingWasFoundWithTransactionWithoutAff verify(storIOSQLite).interceptors(); verify(storIOSQLite).lowLevel(); verify(storIOSQLite).defaultScheduler(); - verify(internal).typeMapping(TestItem.class); - verify(internal, never()).delete(any(DeleteQuery.class)); - verifyNoMoreInteractions(storIOSQLite, internal); + verify(lowLevel).typeMapping(TestItem.class); + verify(lowLevel, never()).delete(any(DeleteQuery.class)); + verifyNoMoreInteractions(storIOSQLite, lowLevel); } @Test public void shouldThrowExceptionIfNoTypeMappingWasFoundWithTransactionWithoutAffectingDbAsSingle() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); when(storIOSQLite.delete()).thenReturn(new PreparedDelete.Builder(storIOSQLite)); @@ -594,17 +591,17 @@ public void shouldThrowExceptionIfNoTypeMappingWasFoundWithTransactionWithoutAff verify(storIOSQLite).interceptors(); verify(storIOSQLite).lowLevel(); verify(storIOSQLite).defaultScheduler(); - verify(internal).typeMapping(TestItem.class); - verify(internal, never()).delete(any(DeleteQuery.class)); - verifyNoMoreInteractions(storIOSQLite, internal); + verify(lowLevel).typeMapping(TestItem.class); + verify(lowLevel, never()).delete(any(DeleteQuery.class)); + verifyNoMoreInteractions(storIOSQLite, lowLevel); } @Test public void shouldThrowExceptionIfNoTypeMappingWasFoundWithTransactionWithoutAffectingDbAsCompletable() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); when(storIOSQLite.delete()).thenReturn(new PreparedDelete.Builder(storIOSQLite)); @@ -630,9 +627,9 @@ public void shouldThrowExceptionIfNoTypeMappingWasFoundWithTransactionWithoutAff verify(storIOSQLite).interceptors(); verify(storIOSQLite).lowLevel(); verify(storIOSQLite).defaultScheduler(); - verify(internal).typeMapping(TestItem.class); - verify(internal, never()).delete(any(DeleteQuery.class)); - verifyNoMoreInteractions(storIOSQLite, internal); + verify(lowLevel).typeMapping(TestItem.class); + verify(lowLevel, never()).delete(any(DeleteQuery.class)); + verifyNoMoreInteractions(storIOSQLite, lowLevel); } } @@ -656,9 +653,9 @@ public void shouldReturnItemsInGetData() { @Test public void shouldFinishTransactionIfExceptionHasOccurredBlocking() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); //noinspection unchecked final DeleteResolver deleteResolver = mock(DeleteResolver.class); @@ -678,23 +675,23 @@ public void shouldFinishTransactionIfExceptionHasOccurredBlocking() { IllegalStateException cause = (IllegalStateException) expected.getCause(); assertThat(cause).hasMessage("test exception"); - verify(internal).beginTransaction(); - verify(internal, never()).setTransactionSuccessful(); - verify(internal).endTransaction(); + verify(lowLevel).beginTransaction(); + verify(lowLevel, never()).setTransactionSuccessful(); + verify(lowLevel).endTransaction(); verify(storIOSQLite).lowLevel(); verify(storIOSQLite).interceptors(); verify(deleteResolver).performDelete(same(storIOSQLite), any()); - verifyNoMoreInteractions(storIOSQLite, internal, deleteResolver); + verifyNoMoreInteractions(storIOSQLite, lowLevel, deleteResolver); } } @Test public void shouldFinishTransactionIfExceptionHasOccurredObservable() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); //noinspection unchecked final DeleteResolver deleteResolver = mock(DeleteResolver.class); @@ -721,23 +718,23 @@ public void shouldFinishTransactionIfExceptionHasOccurredObservable() { IllegalStateException cause = (IllegalStateException) expected.getCause(); assertThat(cause).hasMessage("test exception"); - verify(internal).beginTransaction(); - verify(internal, never()).setTransactionSuccessful(); - verify(internal).endTransaction(); + verify(lowLevel).beginTransaction(); + verify(lowLevel, never()).setTransactionSuccessful(); + verify(lowLevel).endTransaction(); verify(storIOSQLite).lowLevel(); verify(storIOSQLite).interceptors(); verify(storIOSQLite).defaultScheduler(); verify(deleteResolver).performDelete(same(storIOSQLite), any()); - verifyNoMoreInteractions(storIOSQLite, internal, deleteResolver); + verifyNoMoreInteractions(storIOSQLite, lowLevel, deleteResolver); } @Test public void shouldFinishTransactionIfExceptionHasOccurredSingle() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); //noinspection unchecked final DeleteResolver deleteResolver = mock(DeleteResolver.class); @@ -764,23 +761,23 @@ public void shouldFinishTransactionIfExceptionHasOccurredSingle() { IllegalStateException cause = (IllegalStateException) expected.getCause(); assertThat(cause).hasMessage("test exception"); - verify(internal).beginTransaction(); - verify(internal, never()).setTransactionSuccessful(); - verify(internal).endTransaction(); + verify(lowLevel).beginTransaction(); + verify(lowLevel, never()).setTransactionSuccessful(); + verify(lowLevel).endTransaction(); verify(storIOSQLite).lowLevel(); verify(storIOSQLite).interceptors(); verify(storIOSQLite).defaultScheduler(); verify(deleteResolver).performDelete(same(storIOSQLite), any()); - verifyNoMoreInteractions(storIOSQLite, internal, deleteResolver); + verifyNoMoreInteractions(storIOSQLite, lowLevel, deleteResolver); } @Test public void shouldFinishTransactionIfExceptionHasOccurredCompletable() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); //noinspection unchecked final DeleteResolver deleteResolver = mock(DeleteResolver.class); @@ -807,15 +804,15 @@ public void shouldFinishTransactionIfExceptionHasOccurredCompletable() { IllegalStateException cause = (IllegalStateException) expected.getCause(); assertThat(cause).hasMessage("test exception"); - verify(internal).beginTransaction(); - verify(internal, never()).setTransactionSuccessful(); - verify(internal).endTransaction(); + verify(lowLevel).beginTransaction(); + verify(lowLevel, never()).setTransactionSuccessful(); + verify(lowLevel).endTransaction(); verify(storIOSQLite).lowLevel(); verify(storIOSQLite).interceptors(); verify(storIOSQLite).defaultScheduler(); verify(deleteResolver).performDelete(same(storIOSQLite), any()); - verifyNoMoreInteractions(storIOSQLite, internal, deleteResolver); + verifyNoMoreInteractions(storIOSQLite, lowLevel, deleteResolver); } @Test @@ -862,28 +859,5 @@ public void deleteCollectionOfObjectsCompletableExecutesOnSpecifiedScheduler() { schedulerChecker.checkAsCompletable(operation); } - - @Test - public void createObservableReturnsAsRxObservable() { - final DeleteStub deleteStub - = DeleteStub.newStubForMultipleObjectsWithTypeMappingWithoutTransaction(); - - PreparedDeleteCollectionOfObjects preparedOperation = spy(deleteStub.storIOSQLite - .delete() - .objects(deleteStub.itemsRequestedForDelete) - .prepare()); - - Observable> observable = - Observable.just(DeleteResults.newInstance(Collections.emptyMap())); - - //noinspection CheckResult - doReturn(observable).when(preparedOperation).asRxObservable(); - - //noinspection deprecation - assertThat(preparedOperation.createObservable()).isEqualTo(observable); - - //noinspection CheckResult - verify(preparedOperation).asRxObservable(); - } } } diff --git a/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/delete/PreparedDeleteObjectTest.java b/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/delete/PreparedDeleteObjectTest.java index 4dfd30614..c95a6e342 100644 --- a/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/delete/PreparedDeleteObjectTest.java +++ b/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/delete/PreparedDeleteObjectTest.java @@ -14,13 +14,11 @@ import rx.Single; import rx.observers.TestSubscriber; -import static org.assertj.core.api.Java6Assertions.assertThat; import static org.assertj.core.api.Assertions.failBecauseExceptionWasNotThrown; +import static org.assertj.core.api.Java6Assertions.assertThat; import static org.mockito.Matchers.any; -import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; -import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; @@ -154,28 +152,6 @@ public void shouldDeleteObjectWithTypeMappingAsCompletable() { deleteStub.verifyBehaviorForOneObject(completable); } - - @Test - public void createObservableReturnsAsRxObservable() { - final DeleteStub deleteStub = DeleteStub.newStubForOneObjectWithTypeMapping(); - - PreparedDeleteObject preparedOperation = spy(deleteStub.storIOSQLite - .delete() - .object(deleteStub.itemsRequestedForDelete.get(0)) - .prepare()); - - Observable observable = - Observable.just(DeleteResult.newInstance(1, TestItem.TABLE)); - - //noinspection CheckResult - doReturn(observable).when(preparedOperation).asRxObservable(); - - //noinspection deprecation - assertThat(preparedOperation.createObservable()).isEqualTo(observable); - - //noinspection CheckResult - verify(preparedOperation).asRxObservable(); - } } public static class NoTypeMappingError { @@ -183,9 +159,9 @@ public static class NoTypeMappingError { @Test public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAffectingDbBlocking() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); when(storIOSQLite.delete()).thenReturn(new PreparedDelete.Builder(storIOSQLite)); @@ -205,17 +181,17 @@ public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAffectingDbBlockin verify(storIOSQLite).delete(); verify(storIOSQLite).lowLevel(); verify(storIOSQLite).interceptors(); - verify(internal).typeMapping(TestItem.class); - verify(internal, never()).delete(any(DeleteQuery.class)); - verifyNoMoreInteractions(storIOSQLite, internal); + verify(lowLevel).typeMapping(TestItem.class); + verify(lowLevel, never()).delete(any(DeleteQuery.class)); + verifyNoMoreInteractions(storIOSQLite, lowLevel); } @Test public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAffectingDbAsObservable() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); when(storIOSQLite.delete()).thenReturn(new PreparedDelete.Builder(storIOSQLite)); @@ -237,17 +213,17 @@ public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAffectingDbAsObser verify(storIOSQLite).lowLevel(); verify(storIOSQLite).defaultScheduler(); verify(storIOSQLite).interceptors(); - verify(internal).typeMapping(TestItem.class); - verify(internal, never()).delete(any(DeleteQuery.class)); - verifyNoMoreInteractions(storIOSQLite, internal); + verify(lowLevel).typeMapping(TestItem.class); + verify(lowLevel, never()).delete(any(DeleteQuery.class)); + verifyNoMoreInteractions(storIOSQLite, lowLevel); } @Test public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAffectingDbAsSingle() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); when(storIOSQLite.delete()).thenReturn(new PreparedDelete.Builder(storIOSQLite)); @@ -269,17 +245,17 @@ public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAffectingDbAsSingl verify(storIOSQLite).lowLevel(); verify(storIOSQLite).defaultScheduler(); verify(storIOSQLite).interceptors(); - verify(internal).typeMapping(TestItem.class); - verify(internal, never()).delete(any(DeleteQuery.class)); - verifyNoMoreInteractions(storIOSQLite, internal); + verify(lowLevel).typeMapping(TestItem.class); + verify(lowLevel, never()).delete(any(DeleteQuery.class)); + verifyNoMoreInteractions(storIOSQLite, lowLevel); } @Test public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAffectingDbAsCompletable() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); when(storIOSQLite.delete()).thenReturn(new PreparedDelete.Builder(storIOSQLite)); @@ -301,9 +277,9 @@ public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAffectingDbAsCompl verify(storIOSQLite).lowLevel(); verify(storIOSQLite).defaultScheduler(); verify(storIOSQLite).interceptors(); - verify(internal).typeMapping(TestItem.class); - verify(internal, never()).delete(any(DeleteQuery.class)); - verifyNoMoreInteractions(storIOSQLite, internal); + verify(lowLevel).typeMapping(TestItem.class); + verify(lowLevel, never()).delete(any(DeleteQuery.class)); + verifyNoMoreInteractions(storIOSQLite, lowLevel); } } diff --git a/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/execute/PreparedExecuteSQLTest.java b/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/execute/PreparedExecuteSQLTest.java index 9207fae43..5bd3df446 100644 --- a/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/execute/PreparedExecuteSQLTest.java +++ b/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/execute/PreparedExecuteSQLTest.java @@ -26,11 +26,9 @@ import static org.assertj.core.api.Java6Assertions.assertThat; import static org.hamcrest.CoreMatchers.equalTo; import static org.mockito.Matchers.any; -import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; -import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; @@ -264,26 +262,6 @@ public void shouldWrapExceptionIntoStorIOExceptionSingle() { verifyNoMoreInteractions(stub.storIOSQLite, stub.lowLevel); } - @Test - public void createObservableReturnsAsRxObservable() { - final Stub stub = Stub.newInstanceDoNotApplyAffectedTablesAndTags(); - - PreparedExecuteSQL preparedExecuteSQL = spy(stub.storIOSQLite - .executeSQL() - .withQuery(stub.rawQuery) - .prepare()); - - Observable observable = Observable.just(new Object()); - //noinspection CheckResult - doReturn(observable).when(preparedExecuteSQL).asRxObservable(); - - //noinspection deprecation - assertThat(preparedExecuteSQL.createObservable()).isEqualTo(observable); - - //noinspection CheckResult - verify(preparedExecuteSQL).asRxObservable(); - } - static class Stub { private final StorIOSQLite storIOSQLite; diff --git a/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/get/DefaultGetResolverTest.java b/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/get/DefaultGetResolverTest.java index b1b174696..c82826584 100644 --- a/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/get/DefaultGetResolverTest.java +++ b/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/get/DefaultGetResolverTest.java @@ -21,7 +21,7 @@ public class DefaultGetResolverTest { @Test public void rawQuery() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); final RawQuery rawQuery = RawQuery.builder() .query("test sql") @@ -30,9 +30,9 @@ public void rawQuery() { final Cursor expectedCursor = mock(Cursor.class); when(storIOSQLite.lowLevel()) - .thenReturn(internal); + .thenReturn(lowLevel); - when(internal.rawQuery(rawQuery)) + when(lowLevel.rawQuery(rawQuery)) .thenReturn(expectedCursor); final DefaultGetResolver defaultGetResolver = new DefaultGetResolver() { @@ -46,10 +46,10 @@ public TestItem mapFromCursor(@NonNull Cursor cursor) { final Cursor actualCursor = defaultGetResolver.performGet(storIOSQLite, rawQuery); // only one request should occur - verify(internal, times(1)).rawQuery(any(RawQuery.class)); + verify(lowLevel, times(1)).rawQuery(any(RawQuery.class)); // and this request should be equals to original - verify(internal, times(1)).rawQuery(rawQuery); + verify(lowLevel, times(1)).rawQuery(rawQuery); assertThat(actualCursor).isSameAs(expectedCursor); } @@ -57,7 +57,7 @@ public TestItem mapFromCursor(@NonNull Cursor cursor) { @Test public void query() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); final Query query = Query.builder() .table("test_table") @@ -66,9 +66,9 @@ public void query() { final Cursor expectedCursor = mock(Cursor.class); when(storIOSQLite.lowLevel()) - .thenReturn(internal); + .thenReturn(lowLevel); - when(internal.query(query)) + when(lowLevel.query(query)) .thenReturn(expectedCursor); final DefaultGetResolver defaultGetResolver = new DefaultGetResolver() { @@ -82,10 +82,10 @@ public TestItem mapFromCursor(@NonNull Cursor cursor) { final Cursor actualCursor = defaultGetResolver.performGet(storIOSQLite, query); // only one request should occur - verify(internal, times(1)).query(any(Query.class)); + verify(lowLevel, times(1)).query(any(Query.class)); // and this request should be equals to original - verify(internal, times(1)).query(query); + verify(lowLevel, times(1)).query(query); assertThat(actualCursor).isSameAs(expectedCursor); } diff --git a/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/get/GetObjectStub.java b/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/get/GetObjectStub.java index d49156c8c..57419c6de 100644 --- a/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/get/GetObjectStub.java +++ b/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/get/GetObjectStub.java @@ -30,7 +30,7 @@ class GetObjectStub { final StorIOSQLite storIOSQLite; @NonNull - private final StorIOSQLite.Internal internal; + private final StorIOSQLite.LowLevel lowLevel; @NonNull final Query query; @@ -56,10 +56,10 @@ private GetObjectStub(boolean withTypeMapping) { this.withTypeMapping = withTypeMapping; storIOSQLite = mock(StorIOSQLite.class); - internal = mock(StorIOSQLite.Internal.class); + lowLevel = mock(StorIOSQLite.LowLevel.class); when(storIOSQLite.lowLevel()) - .thenReturn(internal); + .thenReturn(lowLevel); String table = "test_table"; String tag = "test_tag"; @@ -115,7 +115,7 @@ public Boolean answer(InvocationOnMock invocation) throws Throwable { typeMapping = mock(SQLiteTypeMapping.class); if (withTypeMapping) { - when(internal.typeMapping(TestItem.class)).thenReturn(typeMapping); + when(lowLevel.typeMapping(TestItem.class)).thenReturn(typeMapping); when(typeMapping.getResolver()).thenReturn(getResolver); } } @@ -160,13 +160,13 @@ void verifyQueryBehavior(@Nullable TestItem actualItem) { verify(storIOSQLite).lowLevel(); // should be called only once because of Performance! - verify(internal).typeMapping(TestItem.class); + verify(lowLevel).typeMapping(TestItem.class); // should be called only once because of Performance! verify(typeMapping).getResolver(); } - verifyNoMoreInteractions(storIOSQLite, internal, cursor); + verifyNoMoreInteractions(storIOSQLite, lowLevel, cursor); } void verifyQueryBehavior(@NonNull Observable observable) { diff --git a/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/get/GetObjectsStub.java b/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/get/GetObjectsStub.java index 21dc4618e..beeb71117 100644 --- a/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/get/GetObjectsStub.java +++ b/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/get/GetObjectsStub.java @@ -34,7 +34,7 @@ class GetObjectsStub { final StorIOSQLite storIOSQLite; @NonNull - private final StorIOSQLite.Internal internal; + private final StorIOSQLite.LowLevel lowLevel; @NonNull final Query query; @@ -60,10 +60,10 @@ private GetObjectsStub(boolean withTypeMapping) { this.withTypeMapping = withTypeMapping; storIOSQLite = mock(StorIOSQLite.class); - internal = mock(StorIOSQLite.Internal.class); + lowLevel = mock(StorIOSQLite.LowLevel.class); when(storIOSQLite.lowLevel()) - .thenReturn(internal); + .thenReturn(lowLevel); String table = "test_table"; String tag = "test_tag"; @@ -131,7 +131,7 @@ public TestItem answer(InvocationOnMock invocation) throws Throwable { typeMapping = mock(SQLiteTypeMapping.class); if (withTypeMapping) { - when(internal.typeMapping(TestItem.class)).thenReturn(typeMapping); + when(lowLevel.typeMapping(TestItem.class)).thenReturn(typeMapping); when(typeMapping.getResolver()).thenReturn(getResolver); } } @@ -179,13 +179,13 @@ void verifyQueryBehavior(@NonNull List actualList) { verify(storIOSQLite).lowLevel(); // should be called only once because of Performance! - verify(internal).typeMapping(TestItem.class); + verify(lowLevel).typeMapping(TestItem.class); // should be called only once because of Performance! verify(typeMapping).getResolver(); } - verifyNoMoreInteractions(storIOSQLite, internal, cursor); + verifyNoMoreInteractions(storIOSQLite, lowLevel, cursor); } void verifyQueryBehavior(@NonNull Observable> observable) { diff --git a/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/get/PreparedGetCursorTest.java b/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/get/PreparedGetCursorTest.java index 9f7ba3672..b817016ae 100644 --- a/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/get/PreparedGetCursorTest.java +++ b/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/get/PreparedGetCursorTest.java @@ -16,14 +16,12 @@ import rx.observers.TestSubscriber; import static java.util.concurrent.TimeUnit.SECONDS; -import static org.assertj.core.api.Java6Assertions.assertThat; import static org.assertj.core.api.Assertions.failBecauseExceptionWasNotThrown; +import static org.assertj.core.api.Java6Assertions.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; -import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -326,27 +324,4 @@ public void getCursorSingleExecutesOnSpecifiedScheduler() { schedulerChecker.checkAsSingle(operation); } - - @Test - public void createObservableReturnsAsRxObservable() { - final GetCursorStub getStub = GetCursorStub.newInstance(); - - PreparedGetCursor preparedOperation = spy(getStub.storIOSQLite - .get() - .cursor() - .withQuery(getStub.query) - .withGetResolver(getStub.getResolverForCursor) - .prepare()); - - Observable observable = Observable.just(mock(Cursor.class)); - - //noinspection CheckResult - doReturn(observable).when(preparedOperation).asRxObservable(); - - //noinspection deprecation - assertThat(preparedOperation.createObservable()).isEqualTo(observable); - - //noinspection CheckResult - verify(preparedOperation).asRxObservable(); - } } diff --git a/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/get/PreparedGetListOfObjectsTest.java b/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/get/PreparedGetListOfObjectsTest.java index 0c9a778d9..2ad1fc3c8 100644 --- a/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/get/PreparedGetListOfObjectsTest.java +++ b/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/get/PreparedGetListOfObjectsTest.java @@ -13,21 +13,18 @@ import org.junit.experimental.runners.Enclosed; import org.junit.runner.RunWith; -import java.util.Collections; import java.util.List; import rx.Observable; import rx.Single; import rx.observers.TestSubscriber; -import static org.assertj.core.api.Java6Assertions.assertThat; import static org.assertj.core.api.Assertions.failBecauseExceptionWasNotThrown; +import static org.assertj.core.api.Java6Assertions.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; -import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; @@ -224,10 +221,10 @@ public static class NoTypeMappingError { @Test public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAccessingDbWithQueryBlocking() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); when(storIOSQLite.get()).thenReturn(new PreparedGet.Builder(storIOSQLite)); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); final PreparedGet> preparedGet = storIOSQLite .get() @@ -246,18 +243,18 @@ public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAccessingDbWithQue verify(storIOSQLite).get(); verify(storIOSQLite).lowLevel(); verify(storIOSQLite).interceptors(); - verify(internal).typeMapping(TestItem.class); - verify(internal, never()).query(any(Query.class)); - verifyNoMoreInteractions(storIOSQLite, internal); + verify(lowLevel).typeMapping(TestItem.class); + verify(lowLevel, never()).query(any(Query.class)); + verifyNoMoreInteractions(storIOSQLite, lowLevel); } @Test public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAccessingDbWithRawQueryBlocking() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); when(storIOSQLite.get()).thenReturn(new PreparedGet.Builder(storIOSQLite)); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); final PreparedGet> preparedGet = storIOSQLite .get() @@ -276,9 +273,9 @@ public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAccessingDbWithRaw verify(storIOSQLite).get(); verify(storIOSQLite).lowLevel(); verify(storIOSQLite).interceptors(); - verify(internal).typeMapping(TestItem.class); - verify(internal, never()).rawQuery(any(RawQuery.class)); - verifyNoMoreInteractions(storIOSQLite, internal); + verify(lowLevel).typeMapping(TestItem.class); + verify(lowLevel, never()).rawQuery(any(RawQuery.class)); + verifyNoMoreInteractions(storIOSQLite, lowLevel); } @SuppressWarnings("unchecked") @@ -320,10 +317,10 @@ public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAccessingDbWithQue @Test public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAccessingDbWithRawQueryAsObservable() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); when(storIOSQLite.get()).thenReturn(new PreparedGet.Builder(storIOSQLite)); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); final TestSubscriber> testSubscriber = new TestSubscriber>(); @@ -345,19 +342,19 @@ public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAccessingDbWithRaw verify(storIOSQLite).lowLevel(); verify(storIOSQLite).defaultScheduler(); verify(storIOSQLite).interceptors(); - verify(internal).typeMapping(TestItem.class); - verify(internal, never()).rawQuery(any(RawQuery.class)); - verifyNoMoreInteractions(storIOSQLite, internal); + verify(lowLevel).typeMapping(TestItem.class); + verify(lowLevel, never()).rawQuery(any(RawQuery.class)); + verifyNoMoreInteractions(storIOSQLite, lowLevel); } @SuppressWarnings("unchecked") @Test public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAccessingDbWithQueryAsSingle() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); when(storIOSQLite.get()).thenReturn(new PreparedGet.Builder(storIOSQLite)); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); final TestSubscriber> testSubscriber = new TestSubscriber>(); @@ -379,18 +376,18 @@ public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAccessingDbWithQue verify(storIOSQLite).lowLevel(); verify(storIOSQLite).defaultScheduler(); verify(storIOSQLite).interceptors(); - verify(internal).typeMapping(TestItem.class); - verify(internal, never()).query(any(Query.class)); - verifyNoMoreInteractions(storIOSQLite, internal); + verify(lowLevel).typeMapping(TestItem.class); + verify(lowLevel, never()).query(any(Query.class)); + verifyNoMoreInteractions(storIOSQLite, lowLevel); } @Test public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAccessingDbWithRawQueryAsSingle() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); when(storIOSQLite.get()).thenReturn(new PreparedGet.Builder(storIOSQLite)); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); final TestSubscriber> testSubscriber = new TestSubscriber>(); @@ -412,9 +409,9 @@ public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAccessingDbWithRaw verify(storIOSQLite).lowLevel(); verify(storIOSQLite).defaultScheduler(); verify(storIOSQLite).interceptors(); - verify(internal).typeMapping(TestItem.class); - verify(internal, never()).rawQuery(any(RawQuery.class)); - verifyNoMoreInteractions(storIOSQLite, internal); + verify(lowLevel).typeMapping(TestItem.class); + verify(lowLevel, never()).rawQuery(any(RawQuery.class)); + verifyNoMoreInteractions(storIOSQLite, lowLevel); } } @@ -707,27 +704,5 @@ public void getListOfObjectsSingleExecutesOnSpecifiedScheduler() { schedulerChecker.checkAsSingle(operation); } - - @Test - public void createObservableReturnsAsRxObservable() { - final GetObjectsStub getStub = GetObjectsStub.newInstanceWithTypeMapping(); - - PreparedGetListOfObjects preparedOperation = spy(getStub.storIOSQLite - .get() - .listOfObjects(TestItem.class) - .withQuery(getStub.query) - .prepare()); - - Observable> observable = Observable.just(Collections.emptyList()); - - //noinspection CheckResult - doReturn(observable).when(preparedOperation).asRxObservable(); - - //noinspection deprecation - assertThat(preparedOperation.createObservable()).isEqualTo(observable); - - //noinspection CheckResult - verify(preparedOperation).asRxObservable(); - } } } diff --git a/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/get/PreparedGetNumberOfResultsTest.java b/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/get/PreparedGetNumberOfResultsTest.java index b5c592178..d1369e65c 100644 --- a/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/get/PreparedGetNumberOfResultsTest.java +++ b/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/get/PreparedGetNumberOfResultsTest.java @@ -15,14 +15,11 @@ import rx.observers.TestSubscriber; import static java.util.concurrent.TimeUnit.SECONDS; -import static org.assertj.core.api.Java6Assertions.assertThat; import static org.assertj.core.api.Assertions.failBecauseExceptionWasNotThrown; +import static org.assertj.core.api.Java6Assertions.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; public class PreparedGetNumberOfResultsTest { @@ -317,27 +314,4 @@ public void getNumberOfResultsSingleExecutesOnSpecifiedScheduler() { schedulerChecker.checkAsSingle(operation); } - - @Test - public void createObservableReturnsAsRxObservable() { - final GetNumberOfResultsStub getStub = GetNumberOfResultsStub.newInstance(); - - PreparedGetNumberOfResults preparedOperation = spy(getStub.storIOSQLite - .get() - .numberOfResults() - .withQuery(getStub.query) - .withGetResolver(getStub.getResolverForNumberOfResults) - .prepare()); - - Observable observable = Observable.just(0); - - //noinspection CheckResult - doReturn(observable).when(preparedOperation).asRxObservable(); - - //noinspection deprecation - assertThat(preparedOperation.createObservable()).isEqualTo(observable); - - //noinspection CheckResult - verify(preparedOperation).asRxObservable(); - } } diff --git a/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/get/PreparedGetObjectTest.java b/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/get/PreparedGetObjectTest.java index 0c008df2e..505a9ef91 100644 --- a/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/get/PreparedGetObjectTest.java +++ b/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/get/PreparedGetObjectTest.java @@ -17,14 +17,12 @@ import rx.Single; import rx.observers.TestSubscriber; -import static org.assertj.core.api.Java6Assertions.assertThat; import static org.assertj.core.api.Assertions.failBecauseExceptionWasNotThrown; +import static org.assertj.core.api.Java6Assertions.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; -import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; @@ -221,10 +219,10 @@ public static class NoTypeMappingError { @Test public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAccessingDbWithQueryBlocking() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); when(storIOSQLite.get()).thenReturn(new PreparedGet.Builder(storIOSQLite)); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); final PreparedGet preparedGet = storIOSQLite .get() @@ -246,9 +244,9 @@ public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAccessingDbWithQue verify(storIOSQLite).get(); verify(storIOSQLite).lowLevel(); verify(storIOSQLite).interceptors(); - verify(internal).typeMapping(TestItem.class); - verify(internal, never()).query(any(Query.class)); - verifyNoMoreInteractions(storIOSQLite, internal); + verify(lowLevel).typeMapping(TestItem.class); + verify(lowLevel, never()).query(any(Query.class)); + verifyNoMoreInteractions(storIOSQLite, lowLevel); } @SuppressWarnings("unchecked") @@ -340,10 +338,10 @@ public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAccessingDbWithQue @Test public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAccessingDbWithRawQueryBlocking() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); when(storIOSQLite.get()).thenReturn(new PreparedGet.Builder(storIOSQLite)); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); final PreparedGet preparedGet = storIOSQLite .get() @@ -365,18 +363,18 @@ public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAccessingDbWithRaw verify(storIOSQLite).get(); verify(storIOSQLite).lowLevel(); verify(storIOSQLite).interceptors(); - verify(internal).typeMapping(TestItem.class); - verify(internal, never()).rawQuery(any(RawQuery.class)); - verifyNoMoreInteractions(storIOSQLite, internal); + verify(lowLevel).typeMapping(TestItem.class); + verify(lowLevel, never()).rawQuery(any(RawQuery.class)); + verifyNoMoreInteractions(storIOSQLite, lowLevel); } @Test public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAccessingDbWithRawQueryAsObservable() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); when(storIOSQLite.get()).thenReturn(new PreparedGet.Builder(storIOSQLite)); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); final TestSubscriber testSubscriber = new TestSubscriber(); @@ -406,18 +404,18 @@ public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAccessingDbWithRaw verify(storIOSQLite).lowLevel(); verify(storIOSQLite).defaultScheduler(); verify(storIOSQLite).interceptors(); - verify(internal).typeMapping(TestItem.class); - verify(internal, never()).rawQuery(any(RawQuery.class)); - verifyNoMoreInteractions(storIOSQLite, internal); + verify(lowLevel).typeMapping(TestItem.class); + verify(lowLevel, never()).rawQuery(any(RawQuery.class)); + verifyNoMoreInteractions(storIOSQLite, lowLevel); } @Test public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAccessingDbWithRawQueryAsSingle() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); when(storIOSQLite.get()).thenReturn(new PreparedGet.Builder(storIOSQLite)); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); final TestSubscriber testSubscriber = new TestSubscriber(); @@ -447,9 +445,9 @@ public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAccessingDbWithRaw verify(storIOSQLite).lowLevel(); verify(storIOSQLite).defaultScheduler(); verify(storIOSQLite).interceptors(); - verify(internal).typeMapping(TestItem.class); - verify(internal, never()).rawQuery(any(RawQuery.class)); - verifyNoMoreInteractions(storIOSQLite, internal); + verify(lowLevel).typeMapping(TestItem.class); + verify(lowLevel, never()).rawQuery(any(RawQuery.class)); + verifyNoMoreInteractions(storIOSQLite, lowLevel); } } @@ -744,27 +742,5 @@ public void getObjectByQuerySingleExecutesOnSpecifiedScheduler() { schedulerChecker.checkAsSingle(operation); } - - @Test - public void createObservableReturnsAsRxObservable() { - final GetObjectStub getStub = GetObjectStub.newInstanceWithTypeMapping(); - - PreparedGetObject preparedOperation = spy(getStub.storIOSQLite - .get() - .object(TestItem.class) - .withQuery(getStub.query) - .prepare()); - - Observable observable = Observable.just(new TestItem()); - - //noinspection CheckResult - doReturn(observable).when(preparedOperation).asRxObservable(); - - //noinspection deprecation - assertThat(preparedOperation.createObservable()).isEqualTo(observable); - - //noinspection CheckResult - verify(preparedOperation).asRxObservable(); - } } } diff --git a/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/put/DefaultPutResolverTest.java b/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/put/DefaultPutResolverTest.java index a5849b07d..6b7c03f48 100644 --- a/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/put/DefaultPutResolverTest.java +++ b/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/put/DefaultPutResolverTest.java @@ -137,11 +137,11 @@ protected ContentValues mapToContentValues(@NonNull TestItem object) { @Test public void update() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); final TestItem testItem = new TestItem(null); // item with some id, should be updated when(storIOSQLite.lowLevel()) - .thenReturn(internal); + .thenReturn(lowLevel); final Query expectedQuery = Query.builder() .table(TestItem.TABLE) @@ -151,7 +151,7 @@ public void update() { final Cursor cursor = mock(Cursor.class); - when(internal.query(eq(expectedQuery))) + when(lowLevel.query(eq(expectedQuery))) .thenReturn(cursor); when(cursor.getCount()) @@ -159,7 +159,7 @@ public void update() { final Integer expectedNumberOfRowsUpdated = 1; - when(internal.update(any(UpdateQuery.class), any(ContentValues.class))) + when(lowLevel.update(any(UpdateQuery.class), any(ContentValues.class))) .thenReturn(expectedNumberOfRowsUpdated); final Set tags = singleton("test_tag"); @@ -197,27 +197,27 @@ protected ContentValues mapToContentValues(@NonNull TestItem object) { // Performing Put that should "update" final PutResult putResult = putResolver.performPut(storIOSQLite, testItem); - verify(internal).beginTransaction(); - verify(internal).setTransactionSuccessful(); - verify(internal).endTransaction(); + verify(lowLevel).beginTransaction(); + verify(lowLevel).setTransactionSuccessful(); + verify(lowLevel).endTransaction(); // checks that it asks db for results - verify(internal).query(eq(expectedQuery)); + verify(lowLevel).query(eq(expectedQuery)); // checks that cursor was closed verify(cursor).close(); // only one query should occur - verify(internal).query(any(Query.class)); + verify(lowLevel).query(any(Query.class)); // checks that required update was performed - verify(internal).update(eq(expectedUpdateQuery), eq(expectedContentValues)); + verify(lowLevel).update(eq(expectedUpdateQuery), eq(expectedContentValues)); // only one update should occur - verify(internal).update(any(UpdateQuery.class), any(ContentValues.class)); + verify(lowLevel).update(any(UpdateQuery.class), any(ContentValues.class)); // no inserts should occur - verify(internal, never()).insert(any(InsertQuery.class), any(ContentValues.class)); + verify(lowLevel, never()).insert(any(InsertQuery.class), any(ContentValues.class)); // put result checks assertThat(putResult.wasInserted()).isFalse(); diff --git a/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/put/PreparedPutCollectionOfObjectsTest.java b/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/put/PreparedPutCollectionOfObjectsTest.java index e7db94c11..0a76f14c7 100644 --- a/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/put/PreparedPutCollectionOfObjectsTest.java +++ b/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/put/PreparedPutCollectionOfObjectsTest.java @@ -13,7 +13,6 @@ import org.junit.runner.RunWith; import java.util.Collection; -import java.util.Collections; import java.util.List; import rx.Completable; @@ -23,14 +22,12 @@ import static java.util.Arrays.asList; import static java.util.Collections.singletonList; -import static org.assertj.core.api.Java6Assertions.assertThat; import static org.assertj.core.api.Assertions.failBecauseExceptionWasNotThrown; +import static org.assertj.core.api.Java6Assertions.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Matchers.same; -import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; -import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; @@ -359,9 +356,9 @@ public static class NoTypeMappingError { @Test public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutTransactionWithoutAffectingDbBlocking() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); when(storIOSQLite.put()).thenReturn(new PreparedPut.Builder(storIOSQLite)); @@ -384,18 +381,18 @@ public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutTransactionWithout verify(storIOSQLite).put(); verify(storIOSQLite).lowLevel(); verify(storIOSQLite).interceptors(); - verify(internal).typeMapping(TestItem.class); - verify(internal, never()).insert(any(InsertQuery.class), any(ContentValues.class)); - verify(internal, never()).update(any(UpdateQuery.class), any(ContentValues.class)); - verifyNoMoreInteractions(storIOSQLite, internal); + verify(lowLevel).typeMapping(TestItem.class); + verify(lowLevel, never()).insert(any(InsertQuery.class), any(ContentValues.class)); + verify(lowLevel, never()).update(any(UpdateQuery.class), any(ContentValues.class)); + verifyNoMoreInteractions(storIOSQLite, lowLevel); } @Test public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutTransactionWithoutAffectingDbAsObservable() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); when(storIOSQLite.put()).thenReturn(new PreparedPut.Builder(storIOSQLite)); @@ -421,18 +418,18 @@ public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutTransactionWithout verify(storIOSQLite).lowLevel(); verify(storIOSQLite).defaultScheduler(); verify(storIOSQLite).interceptors(); - verify(internal).typeMapping(TestItem.class); - verify(internal, never()).insert(any(InsertQuery.class), any(ContentValues.class)); - verify(internal, never()).update(any(UpdateQuery.class), any(ContentValues.class)); - verifyNoMoreInteractions(storIOSQLite, internal); + verify(lowLevel).typeMapping(TestItem.class); + verify(lowLevel, never()).insert(any(InsertQuery.class), any(ContentValues.class)); + verify(lowLevel, never()).update(any(UpdateQuery.class), any(ContentValues.class)); + verifyNoMoreInteractions(storIOSQLite, lowLevel); } @Test public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutTransactionWithoutAffectingDbAsSingle() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); when(storIOSQLite.put()).thenReturn(new PreparedPut.Builder(storIOSQLite)); @@ -458,18 +455,18 @@ public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutTransactionWithout verify(storIOSQLite).lowLevel(); verify(storIOSQLite).defaultScheduler(); verify(storIOSQLite).interceptors(); - verify(internal).typeMapping(TestItem.class); - verify(internal, never()).insert(any(InsertQuery.class), any(ContentValues.class)); - verify(internal, never()).update(any(UpdateQuery.class), any(ContentValues.class)); - verifyNoMoreInteractions(storIOSQLite, internal); + verify(lowLevel).typeMapping(TestItem.class); + verify(lowLevel, never()).insert(any(InsertQuery.class), any(ContentValues.class)); + verify(lowLevel, never()).update(any(UpdateQuery.class), any(ContentValues.class)); + verifyNoMoreInteractions(storIOSQLite, lowLevel); } @Test public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutTransactionWithoutAffectingDbAsCompletable() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); when(storIOSQLite.put()).thenReturn(new PreparedPut.Builder(storIOSQLite)); @@ -495,18 +492,18 @@ public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutTransactionWithout verify(storIOSQLite).lowLevel(); verify(storIOSQLite).defaultScheduler(); verify(storIOSQLite).interceptors(); - verify(internal).typeMapping(TestItem.class); - verify(internal, never()).insert(any(InsertQuery.class), any(ContentValues.class)); - verify(internal, never()).update(any(UpdateQuery.class), any(ContentValues.class)); - verifyNoMoreInteractions(storIOSQLite, internal); + verify(lowLevel).typeMapping(TestItem.class); + verify(lowLevel, never()).insert(any(InsertQuery.class), any(ContentValues.class)); + verify(lowLevel, never()).update(any(UpdateQuery.class), any(ContentValues.class)); + verifyNoMoreInteractions(storIOSQLite, lowLevel); } @Test public void shouldThrowExceptionIfNoTypeMappingWasFoundWithTransactionWithoutAffectingDbBlocking() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); when(storIOSQLite.put()).thenReturn(new PreparedPut.Builder(storIOSQLite)); @@ -529,18 +526,18 @@ public void shouldThrowExceptionIfNoTypeMappingWasFoundWithTransactionWithoutAff verify(storIOSQLite).put(); verify(storIOSQLite).lowLevel(); verify(storIOSQLite).interceptors(); - verify(internal).typeMapping(TestItem.class); - verify(internal, never()).insert(any(InsertQuery.class), any(ContentValues.class)); - verify(internal, never()).update(any(UpdateQuery.class), any(ContentValues.class)); - verifyNoMoreInteractions(storIOSQLite, internal); + verify(lowLevel).typeMapping(TestItem.class); + verify(lowLevel, never()).insert(any(InsertQuery.class), any(ContentValues.class)); + verify(lowLevel, never()).update(any(UpdateQuery.class), any(ContentValues.class)); + verifyNoMoreInteractions(storIOSQLite, lowLevel); } @Test public void shouldThrowExceptionIfNoTypeMappingWasFoundWithTransactionWithoutAffectingDbAsObservable() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); when(storIOSQLite.put()).thenReturn(new PreparedPut.Builder(storIOSQLite)); @@ -566,18 +563,18 @@ public void shouldThrowExceptionIfNoTypeMappingWasFoundWithTransactionWithoutAff verify(storIOSQLite).lowLevel(); verify(storIOSQLite).defaultScheduler(); verify(storIOSQLite).interceptors(); - verify(internal).typeMapping(TestItem.class); - verify(internal, never()).insert(any(InsertQuery.class), any(ContentValues.class)); - verify(internal, never()).update(any(UpdateQuery.class), any(ContentValues.class)); - verifyNoMoreInteractions(storIOSQLite, internal); + verify(lowLevel).typeMapping(TestItem.class); + verify(lowLevel, never()).insert(any(InsertQuery.class), any(ContentValues.class)); + verify(lowLevel, never()).update(any(UpdateQuery.class), any(ContentValues.class)); + verifyNoMoreInteractions(storIOSQLite, lowLevel); } @Test public void shouldThrowExceptionIfNoTypeMappingWasFoundWithTransactionWithoutAffectingDbAsSingle() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); when(storIOSQLite.put()).thenReturn(new PreparedPut.Builder(storIOSQLite)); @@ -603,18 +600,18 @@ public void shouldThrowExceptionIfNoTypeMappingWasFoundWithTransactionWithoutAff verify(storIOSQLite).lowLevel(); verify(storIOSQLite).defaultScheduler(); verify(storIOSQLite).interceptors(); - verify(internal).typeMapping(TestItem.class); - verify(internal, never()).insert(any(InsertQuery.class), any(ContentValues.class)); - verify(internal, never()).update(any(UpdateQuery.class), any(ContentValues.class)); - verifyNoMoreInteractions(storIOSQLite, internal); + verify(lowLevel).typeMapping(TestItem.class); + verify(lowLevel, never()).insert(any(InsertQuery.class), any(ContentValues.class)); + verify(lowLevel, never()).update(any(UpdateQuery.class), any(ContentValues.class)); + verifyNoMoreInteractions(storIOSQLite, lowLevel); } @Test public void shouldThrowExceptionIfNoTypeMappingWasFoundWithTransactionWithoutAffectingDbAsCompletable() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); when(storIOSQLite.put()).thenReturn(new PreparedPut.Builder(storIOSQLite)); @@ -640,10 +637,10 @@ public void shouldThrowExceptionIfNoTypeMappingWasFoundWithTransactionWithoutAff verify(storIOSQLite).lowLevel(); verify(storIOSQLite).defaultScheduler(); verify(storIOSQLite).interceptors(); - verify(internal).typeMapping(TestItem.class); - verify(internal, never()).insert(any(InsertQuery.class), any(ContentValues.class)); - verify(internal, never()).update(any(UpdateQuery.class), any(ContentValues.class)); - verifyNoMoreInteractions(storIOSQLite, internal); + verify(lowLevel).typeMapping(TestItem.class); + verify(lowLevel, never()).insert(any(InsertQuery.class), any(ContentValues.class)); + verify(lowLevel, never()).update(any(UpdateQuery.class), any(ContentValues.class)); + verifyNoMoreInteractions(storIOSQLite, lowLevel); } } @@ -1056,30 +1053,6 @@ public void putCollectionOfObjectsCompletableExecutesOnSpecifiedScheduler() { schedulerChecker.checkAsCompletable(operation); } - @Test - public void createObservableReturnsAsRxObservable() { - final PutObjectsStub putStub - = PutObjectsStub.newPutStubForMultipleObjectsWithTypeMappingWithTransaction(); - - PreparedPutCollectionOfObjects preparedOperation = spy(putStub.storIOSQLite - .put() - .objects(putStub.items) - .useTransaction(true) - .prepare()); - - Observable> observable = - Observable.just(PutResults.newInstance(Collections.emptyMap())); - - //noinspection CheckResult - doReturn(observable).when(preparedOperation).asRxObservable(); - - //noinspection deprecation - assertThat(preparedOperation.createObservable()).isEqualTo(observable); - - //noinspection CheckResult - verify(preparedOperation).asRxObservable(); - } - @Test public void shouldNotNotifyIfCollectionEmptyWithoutTransaction() { final PutObjectsStub putStub = PutObjectsStub.newPutStubForEmptyCollectionWithoutTransaction(); diff --git a/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/put/PreparedPutContentValuesIterableTest.java b/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/put/PreparedPutContentValuesIterableTest.java index 27cdd7222..3fa598a3f 100644 --- a/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/put/PreparedPutContentValuesIterableTest.java +++ b/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/put/PreparedPutContentValuesIterableTest.java @@ -10,7 +10,6 @@ import org.junit.Test; import org.junit.rules.ExpectedException; -import java.util.Collections; import java.util.List; import rx.Completable; @@ -19,18 +18,16 @@ import rx.observers.TestSubscriber; import static java.util.Collections.singletonList; -import static org.assertj.core.api.Java6Assertions.assertThat; import static org.assertj.core.api.Assertions.failBecauseExceptionWasNotThrown; +import static org.assertj.core.api.Java6Assertions.assertThat; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.startsWith; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Matchers.any; import static org.mockito.Matchers.same; -import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; -import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; @@ -176,9 +173,9 @@ public void putMultipleCompletableWithoutTransaction() { @Test public void shouldFinishTransactionIfExceptionHasOccurredBlocking() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); //noinspection unchecked final PutResolver putResolver = mock(PutResolver.class); @@ -200,24 +197,24 @@ public void shouldFinishTransactionIfExceptionHasOccurredBlocking() { IllegalStateException cause = (IllegalStateException) expected.getCause(); assertThat(cause).hasMessage("test exception"); - verify(internal).beginTransaction(); - verify(internal, never()).setTransactionSuccessful(); - verify(internal).endTransaction(); + verify(lowLevel).beginTransaction(); + verify(lowLevel, never()).setTransactionSuccessful(); + verify(lowLevel).endTransaction(); verify(storIOSQLite).lowLevel(); verify(storIOSQLite).interceptors(); verify(putResolver).performPut(same(storIOSQLite), any(ContentValues.class)); - verifyNoMoreInteractions(storIOSQLite, internal, putResolver); + verifyNoMoreInteractions(storIOSQLite, lowLevel, putResolver); } } @Test public void shouldFinishTransactionIfExceptionHasOccurredObservable() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); //noinspection unchecked final PutResolver putResolver = mock(PutResolver.class); @@ -246,23 +243,23 @@ public void shouldFinishTransactionIfExceptionHasOccurredObservable() { IllegalStateException cause = (IllegalStateException) expected.getCause(); assertThat(cause).hasMessage("test exception"); - verify(internal).beginTransaction(); - verify(internal, never()).setTransactionSuccessful(); - verify(internal).endTransaction(); + verify(lowLevel).beginTransaction(); + verify(lowLevel, never()).setTransactionSuccessful(); + verify(lowLevel).endTransaction(); verify(storIOSQLite).lowLevel(); verify(storIOSQLite).defaultScheduler(); verify(storIOSQLite).interceptors(); verify(putResolver).performPut(same(storIOSQLite), any(ContentValues.class)); - verifyNoMoreInteractions(storIOSQLite, internal, putResolver); + verifyNoMoreInteractions(storIOSQLite, lowLevel, putResolver); } @Test public void shouldFinishTransactionIfExceptionHasOccurredSingle() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); //noinspection unchecked final PutResolver putResolver = mock(PutResolver.class); @@ -291,23 +288,23 @@ public void shouldFinishTransactionIfExceptionHasOccurredSingle() { IllegalStateException cause = (IllegalStateException) expected.getCause(); assertThat(cause).hasMessage("test exception"); - verify(internal).beginTransaction(); - verify(internal, never()).setTransactionSuccessful(); - verify(internal).endTransaction(); + verify(lowLevel).beginTransaction(); + verify(lowLevel, never()).setTransactionSuccessful(); + verify(lowLevel).endTransaction(); verify(storIOSQLite).lowLevel(); verify(storIOSQLite).defaultScheduler(); verify(storIOSQLite).interceptors(); verify(putResolver).performPut(same(storIOSQLite), any(ContentValues.class)); - verifyNoMoreInteractions(storIOSQLite, internal, putResolver); + verifyNoMoreInteractions(storIOSQLite, lowLevel, putResolver); } @Test public void shouldFinishTransactionIfExceptionHasOccurredCompletable() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); //noinspection unchecked final PutResolver putResolver = mock(PutResolver.class); @@ -336,21 +333,21 @@ public void shouldFinishTransactionIfExceptionHasOccurredCompletable() { IllegalStateException cause = (IllegalStateException) expected.getCause(); assertThat(cause).hasMessage("test exception"); - verify(internal).beginTransaction(); - verify(internal, never()).setTransactionSuccessful(); - verify(internal).endTransaction(); + verify(lowLevel).beginTransaction(); + verify(lowLevel, never()).setTransactionSuccessful(); + verify(lowLevel).endTransaction(); verify(storIOSQLite).lowLevel(); verify(storIOSQLite).defaultScheduler(); verify(storIOSQLite).interceptors(); verify(putResolver).performPut(same(storIOSQLite), any(ContentValues.class)); - verifyNoMoreInteractions(storIOSQLite, internal, putResolver); + verifyNoMoreInteractions(storIOSQLite, lowLevel, putResolver); } @Test public void verifyBehaviorInCaseOfExceptionWithoutTransactionBlocking() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); //noinspection unchecked final PutResolver putResolver = mock(PutResolver.class); @@ -373,19 +370,19 @@ public void verifyBehaviorInCaseOfExceptionWithoutTransactionBlocking() { assertThat(cause).hasMessage("test exception"); // Main check of this test - verify(internal, never()).endTransaction(); + verify(lowLevel, never()).endTransaction(); verify(storIOSQLite).lowLevel(); verify(storIOSQLite).interceptors(); verify(putResolver).performPut(same(storIOSQLite), any(ContentValues.class)); - verifyNoMoreInteractions(storIOSQLite, internal, putResolver); + verifyNoMoreInteractions(storIOSQLite, lowLevel, putResolver); } } @Test public void verifyBehaviorInCaseOfExceptionWithoutTransactionObservable() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); //noinspection unchecked final PutResolver putResolver = mock(PutResolver.class); @@ -415,19 +412,19 @@ public void verifyBehaviorInCaseOfExceptionWithoutTransactionObservable() { assertThat(cause).hasMessage("test exception"); // Main check of this test - verify(internal, never()).endTransaction(); + verify(lowLevel, never()).endTransaction(); verify(storIOSQLite).lowLevel(); verify(storIOSQLite).defaultScheduler(); verify(storIOSQLite).interceptors(); verify(putResolver).performPut(same(storIOSQLite), any(ContentValues.class)); - verifyNoMoreInteractions(storIOSQLite, internal, putResolver); + verifyNoMoreInteractions(storIOSQLite, lowLevel, putResolver); } @Test public void verifyBehaviorInCaseOfExceptionWithoutTransactionSingle() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); //noinspection unchecked final PutResolver putResolver = mock(PutResolver.class); @@ -457,19 +454,19 @@ public void verifyBehaviorInCaseOfExceptionWithoutTransactionSingle() { assertThat(cause).hasMessage("test exception"); // Main check of this test - verify(internal, never()).endTransaction(); + verify(lowLevel, never()).endTransaction(); verify(storIOSQLite).lowLevel(); verify(storIOSQLite).defaultScheduler(); verify(storIOSQLite).interceptors(); verify(putResolver).performPut(same(storIOSQLite), any(ContentValues.class)); - verifyNoMoreInteractions(storIOSQLite, internal, putResolver); + verifyNoMoreInteractions(storIOSQLite, lowLevel, putResolver); } @Test public void verifyBehaviorInCaseOfExceptionWithoutTransactionCompletable() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); //noinspection unchecked final PutResolver putResolver = mock(PutResolver.class); @@ -499,13 +496,13 @@ public void verifyBehaviorInCaseOfExceptionWithoutTransactionCompletable() { assertThat(cause).hasMessage("test exception"); // Main check of this test - verify(internal, never()).endTransaction(); + verify(lowLevel, never()).endTransaction(); verify(storIOSQLite).lowLevel(); verify(storIOSQLite).defaultScheduler(); verify(storIOSQLite).interceptors(); verify(putResolver).performPut(same(storIOSQLite), any(ContentValues.class)); - verifyNoMoreInteractions(storIOSQLite, internal, putResolver); + verifyNoMoreInteractions(storIOSQLite, lowLevel, putResolver); } @Test @@ -682,30 +679,6 @@ public void shouldWrapExceptionIntoStorIOExceptionCompletable() { verifyNoMoreInteractions(stub.storIOSQLite, stub.lowLevel); } - @Test - public void createObservableReturnsAsRxObservable() { - final PutContentValuesStub putStub = PutContentValuesStub.newPutStubForMultipleContentValues(true); - - PreparedPutContentValuesIterable preparedOperation = spy(putStub.storIOSQLite - .put() - .contentValues(putStub.contentValues) - .withPutResolver(putStub.putResolver) - .useTransaction(true) - .prepare()); - - Observable> observable = - Observable.just(PutResults.newInstance(Collections.emptyMap())); - - //noinspection CheckResult - doReturn(observable).when(preparedOperation).asRxObservable(); - - //noinspection deprecation - assertThat(preparedOperation.createObservable()).isEqualTo(observable); - - //noinspection CheckResult - verify(preparedOperation).asRxObservable(); - } - @Test public void shouldNotNotifyIfCollectionEmptyWithoutTransaction() { final PutContentValuesStub putStub = PutContentValuesStub.newPutStubForEmptyCollectionWithoutTransaction(); diff --git a/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/put/PreparedPutContentValuesTest.java b/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/put/PreparedPutContentValuesTest.java index c45eb30c4..b65e71344 100644 --- a/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/put/PreparedPutContentValuesTest.java +++ b/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/put/PreparedPutContentValuesTest.java @@ -16,9 +16,7 @@ import static org.assertj.core.api.Java6Assertions.assertThat; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.startsWith; -import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; -import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; @@ -227,28 +225,6 @@ public void shouldWrapExceptionIntoStorIOExceptionCompletable() { verifyNoMoreInteractions(stub.storIOSQLite, stub.lowLevel); } - @Test - public void createObservableReturnsAsRxObservable() { - final PutContentValuesStub putStub = PutContentValuesStub.newPutStubForOneContentValues(); - - PreparedPutContentValues preparedOperation = spy(putStub.storIOSQLite - .put() - .contentValues(putStub.contentValues.get(0)) - .withPutResolver(putStub.putResolver) - .prepare()); - - Observable observable = Observable.just(PutResult.newInsertResult(1, TestItem.TABLE)); - - //noinspection CheckResult - doReturn(observable).when(preparedOperation).asRxObservable(); - - //noinspection deprecation - assertThat(preparedOperation.createObservable()).isEqualTo(observable); - - //noinspection CheckResult - verify(preparedOperation).asRxObservable(); - } - @Test public void shouldNotNotifyIfWasNotInsertedAndUpdated() { final PutContentValuesStub putStub = PutContentValuesStub.newPutStubForOneContentValuesWithoutInsertsAndUpdates(); diff --git a/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/put/PreparedPutObjectTest.java b/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/put/PreparedPutObjectTest.java index 880ed8db8..637b3b400 100644 --- a/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/put/PreparedPutObjectTest.java +++ b/storio-sqlite/src/test/java/com/pushtorefresh/storio2/sqlite/operations/put/PreparedPutObjectTest.java @@ -15,9 +15,7 @@ import static org.assertj.core.api.Assertions.failBecauseExceptionWasNotThrown; import static org.assertj.core.api.Java6Assertions.assertThat; -import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; @@ -144,9 +142,9 @@ public static class TypeMappingError { @Test public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAffectingDbBlocking() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); final Object object = new Object(); @@ -164,17 +162,17 @@ public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAffectingDbBlockin verify(storIOSQLite).lowLevel(); verify(storIOSQLite).interceptors(); - verify(internal).typeMapping(Object.class); - verifyNoMoreInteractions(storIOSQLite, internal); + verify(lowLevel).typeMapping(Object.class); + verifyNoMoreInteractions(storIOSQLite, lowLevel); } } @Test public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAffectingDbObservable() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); final Object object = new Object(); @@ -201,16 +199,16 @@ public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAffectingDbObserva verify(storIOSQLite).lowLevel(); verify(storIOSQLite).defaultScheduler(); verify(storIOSQLite).interceptors(); - verify(internal).typeMapping(Object.class); - verifyNoMoreInteractions(storIOSQLite, internal); + verify(lowLevel).typeMapping(Object.class); + verifyNoMoreInteractions(storIOSQLite, lowLevel); } @Test public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAffectingDbSingle() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); final Object object = new Object(); @@ -237,16 +235,16 @@ public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAffectingDbSingle( verify(storIOSQLite).lowLevel(); verify(storIOSQLite).defaultScheduler(); verify(storIOSQLite).interceptors(); - verify(internal).typeMapping(Object.class); - verifyNoMoreInteractions(storIOSQLite, internal); + verify(lowLevel).typeMapping(Object.class); + verifyNoMoreInteractions(storIOSQLite, lowLevel); } @Test public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAffectingDbCompletable() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); - final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); + final StorIOSQLite.LowLevel lowLevel = mock(StorIOSQLite.LowLevel.class); - when(storIOSQLite.lowLevel()).thenReturn(internal); + when(storIOSQLite.lowLevel()).thenReturn(lowLevel); final Object object = new Object(); @@ -273,8 +271,8 @@ public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAffectingDbComplet verify(storIOSQLite).lowLevel(); verify(storIOSQLite).defaultScheduler(); verify(storIOSQLite).interceptors(); - verify(internal).typeMapping(Object.class); - verifyNoMoreInteractions(storIOSQLite, internal); + verify(lowLevel).typeMapping(Object.class); + verifyNoMoreInteractions(storIOSQLite, lowLevel); } } @@ -333,27 +331,6 @@ public void putObjectAsCompletableExecutesOnSpecifiedScheduler() { schedulerChecker.checkAsCompletable(operation); } - @Test - public void createObservableReturnsAsRxObservable() { - final PutObjectsStub putStub = PutObjectsStub.newPutStubForOneObjectWithTypeMapping(); - - PreparedPutObject preparedOperation = spy(putStub.storIOSQLite - .put() - .object(putStub.items.get(0)) - .prepare()); - - Observable observable = Observable.just(PutResult.newInsertResult(1, TestItem.TABLE)); - - //noinspection CheckResult - doReturn(observable).when(preparedOperation).asRxObservable(); - - //noinspection deprecation - assertThat(preparedOperation.createObservable()).isEqualTo(observable); - - //noinspection CheckResult - verify(preparedOperation).asRxObservable(); - } - @Test public void shouldNotNotifyIfWasNotInsertedAndUpdatedWithoutTypeMapping() { final PutObjectsStub putStub = PutObjectsStub.newPutStubForOneObjectWithoutInsertsAndUpdatesWithoutTypeMapping(); @@ -381,4 +358,4 @@ public void shouldNotNotifyIfWasNotInsertedAndUpdatedWithTypeMapping() { putStub.verifyBehaviorForOneObject(putResult); } } -} \ No newline at end of file +}