Skip to content

Commit

Permalink
Rebase problems fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
rsinukov committed Apr 10, 2017
1 parent 83e4701 commit 19a45a5
Show file tree
Hide file tree
Showing 12 changed files with 68 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import rx.Observable;
import rx.Single;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Java6Assertions.assertThat;

public class PreparedDeleteByQueryTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import rx.Observable;
import rx.Single;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Java6Assertions.assertThat;

public class PreparedPutContentValuesIterableTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import rx.Observable;
import rx.Single;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Java6Assertions.assertThat;

public class PreparedPutContentValuesTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import rx.Observable;
import rx.Single;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Java6Assertions.assertThat;

@RunWith(RobolectricTestRunner.class)
public class LoggingInterceptorTest {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.pushtorefresh.storio.sqlite.impl;

import com.pushtorefresh.storio.operations.PreparedOperation;
import com.pushtorefresh.storio.sqlite.Interceptor;
import com.pushtorefresh.storio.sqlite.Interceptor.Chain;

import org.junit.Test;

import java.util.Collections;
import java.util.List;

import static org.assertj.core.api.Fail.failBecauseExceptionWasNotThrown;
import static org.assertj.core.api.Java6Assertions.assertThat;
import static org.mockito.Mockito.mock;

public class ChainImplTest {

@Test
public void proceed_shouldThrowIfIteratorEmpty() {
try {
final List<Interceptor> empty = Collections.emptyList();
final Chain chain = new ChainImpl(empty.listIterator());
chain.proceed(mock(PreparedOperation.class));
failBecauseExceptionWasNotThrown(IllegalStateException.class);
} catch (IllegalStateException e) {
assertThat(e).hasMessage("proceed was called on empty iterator");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ class TestDefaultStorIOSQLite extends DefaultStorIOSQLite {
private final Internal internal;

TestDefaultStorIOSQLite(@NonNull SQLiteOpenHelper sqLiteOpenHelper, @NonNull TypeMappingFinder typeMappingFinder) {
super(sqLiteOpenHelper, typeMappingFinder, null);
super(sqLiteOpenHelper, typeMappingFinder, null, Collections.<Interceptor>emptyList());
internal = new InternalImpl(typeMappingFinder);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public void beforeEachTest() {
tagChanges = Changes.newInstance("yet_another_table", UserTableMeta.NOTIFICATION_TAG);
}

public <T> void verifyChangesReceived(
@NonNull PreparedOperation<T> operation,
public <T, Data> void verifyChangesReceived(
@NonNull PreparedOperation<T, Data> operation,
@NonNull Changes changes,
@NonNull T value
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import static com.pushtorefresh.storio.sqlite.integration.TweetTableMeta.COLUMN_AUTHOR_ID;
import static com.pushtorefresh.storio.sqlite.integration.TweetTableMeta.COLUMN_CONTENT_TEXT;
import static com.pushtorefresh.storio.sqlite.integration.TweetTableMeta.COLUMN_ID;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Java6Assertions.assertThat;

@RunWith(RobolectricTestRunner.class)
@Config(constants = BuildConfig.class, sdk = 21)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ public void shouldWrapExceptionIntoStorIOExceptionObservable() {
verify(stub.storIOSQLite).defaultScheduler();
verify(stub.storIOSQLite).lowLevel();
verify(stub.lowLevel).executeSQL(stub.rawQuery);
verify(stub.storIOSQLite).interceptors();
verifyNoMoreInteractions(stub.storIOSQLite, stub.lowLevel);
}

Expand Down Expand Up @@ -244,6 +245,7 @@ public void shouldWrapExceptionIntoStorIOExceptionSingle() {
verify(stub.storIOSQLite).defaultScheduler();
verify(stub.storIOSQLite).lowLevel();
verify(stub.lowLevel).executeSQL(stub.rawQuery);
verify(stub.storIOSQLite).interceptors();
verifyNoMoreInteractions(stub.storIOSQLite, stub.lowLevel);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.pushtorefresh.storio.sqlite.queries.Query;

import org.junit.Test;
import org.robolectric.util.ReflectionHelpers;

import rx.Observable;
import rx.Single;
Expand All @@ -28,6 +29,28 @@

public class PreparedGetCursorTest {

@Test
public void shouldThrowIfNoQueryOrRawQueryIsSet() {
try {
final GetCursorStub getStub = GetCursorStub.newInstance();

final PreparedGetCursor operation = getStub.storIOSQLite
.get()
.cursor()
.withQuery(getStub.query) // will be removed
.withGetResolver(getStub.getResolverForCursor)
.prepare();

ReflectionHelpers.setField(operation, "query", null);
ReflectionHelpers.setField(operation, "rawQuery", null);
operation.getData();

failBecauseExceptionWasNotThrown(IllegalStateException.class);
} catch (IllegalStateException e) {
assertThat(e).hasMessage("Either rawQuery or query should be set!");
}
}

@Test
public void shouldReturnQueryInGetData() {
final GetCursorStub getStub = GetCursorStub.newInstance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,7 @@ public void shouldWrapExceptionIntoStorIOExceptionObservable() {
verify(stub.lowLevel).beginTransaction();
verify(stub.lowLevel).endTransaction();
verify(stub.storIOSQLite).defaultScheduler();
verify(stub.storIOSQLite).interceptors();
verifyNoMoreInteractions(stub.storIOSQLite, stub.lowLevel);
}

Expand Down Expand Up @@ -640,6 +641,7 @@ public void shouldWrapExceptionIntoStorIOExceptionSingle() {
verify(stub.lowLevel).beginTransaction();
verify(stub.lowLevel).endTransaction();
verify(stub.storIOSQLite).defaultScheduler();
verify(stub.storIOSQLite).interceptors();
verifyNoMoreInteractions(stub.storIOSQLite, stub.lowLevel);
}

Expand Down Expand Up @@ -676,6 +678,7 @@ public void shouldWrapExceptionIntoStorIOExceptionCompletable() {
verify(stub.lowLevel).beginTransaction();
verify(stub.lowLevel).endTransaction();
verify(stub.storIOSQLite).defaultScheduler();
verify(stub.storIOSQLite).interceptors();
verifyNoMoreInteractions(stub.storIOSQLite, stub.lowLevel);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;

import static org.assertj.core.api.Assertions.assertThat;

public class PreparedPutContentValuesTest {

@Rule
Expand Down Expand Up @@ -153,6 +151,7 @@ public void shouldWrapExceptionIntoStorIOExceptionObservable() {

verify(stub.storIOSQLite).put();
verify(stub.storIOSQLite).defaultScheduler();
verify(stub.storIOSQLite).interceptors();
verifyNoMoreInteractions(stub.storIOSQLite, stub.lowLevel);
}

Expand Down Expand Up @@ -188,6 +187,7 @@ public void shouldWrapExceptionIntoStorIOExceptionSingle() {

verify(stub.storIOSQLite).put();
verify(stub.storIOSQLite).defaultScheduler();
verify(stub.storIOSQLite).interceptors();
verifyNoMoreInteractions(stub.storIOSQLite, stub.lowLevel);
}

Expand Down Expand Up @@ -223,6 +223,7 @@ public void shouldWrapExceptionIntoStorIOExceptionCompletable() {

verify(stub.storIOSQLite).put();
verify(stub.storIOSQLite).defaultScheduler();
verify(stub.storIOSQLite).interceptors();
verifyNoMoreInteractions(stub.storIOSQLite, stub.lowLevel);
}

Expand Down

0 comments on commit 19a45a5

Please sign in to comment.