Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce explicit re-fetch query for mutation operation. #504

Merged
merged 15 commits into from
May 27, 2017
Prev Previous commit
Next Next commit
Update
  • Loading branch information
sav007 committed May 14, 2017
commit 0b0de42e342dd2f4c5d9bda786961c1771ea803b
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class ApolloCallbackTest {
final AtomicBoolean invoked = new AtomicBoolean();
final Handler callbackHandler = mockCallbackHandler(invoked);
server.enqueue(new MockResponse().setResponseCode(401).setBody("Unauthorized request!"));
apolloClient.newCall(EMPTY_QUERY).enqueue(ApolloCallback.wrap(new ApolloCall.Callback() {
apolloClient.query(EMPTY_QUERY).enqueue(ApolloCallback.wrap(new ApolloCall.Callback() {
@Override public void onResponse(@Nonnull Response response) {
fail("Expected onHttpError");
}
Expand All @@ -71,7 +71,7 @@ public class ApolloCallbackTest {
final CountDownLatch countDownLatch = new CountDownLatch(1);
final AtomicBoolean invoked = new AtomicBoolean();
final Handler callbackHandler = mockCallbackHandler(invoked);
apolloClient.newCall(EMPTY_QUERY).enqueue(ApolloCallback.wrap(new ApolloCall.Callback() {
apolloClient.query(EMPTY_QUERY).enqueue(ApolloCallback.wrap(new ApolloCall.Callback() {
@Override public void onResponse(@Nonnull Response response) {
fail("Expected onNetworkError");
}
Expand All @@ -93,7 +93,7 @@ public class ApolloCallbackTest {
final AtomicBoolean invoked = new AtomicBoolean();
final Handler callbackHandler = mockCallbackHandler(invoked);
server.enqueue(new MockResponse().setResponseCode(200).setBody("nonsense"));
apolloClient.newCall(EMPTY_QUERY).enqueue(ApolloCallback.wrap(new ApolloCall.Callback() {
apolloClient.query(EMPTY_QUERY).enqueue(ApolloCallback.wrap(new ApolloCall.Callback() {
@Override public void onResponse(@Nonnull Response response) {
fail("Expected onParseError");
}
Expand Down Expand Up @@ -127,7 +127,7 @@ public class ApolloCallbackTest {
" }" +
" ]" +
"}"));
apolloClient.newCall(EMPTY_QUERY).enqueue(ApolloCallback.wrap(new ApolloCall.Callback() {
apolloClient.query(EMPTY_QUERY).enqueue(ApolloCallback.wrap(new ApolloCall.Callback() {
@Override public void onResponse(@Nonnull Response response) {
countDownLatch.countDown();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.os.Looper;

import com.apollographql.apollo.api.OperationName;
import com.apollographql.apollo.api.Query;
import com.apollographql.apollo.api.ResponseFieldMapper;
import com.apollographql.apollo.api.ResponseReader;
Expand All @@ -10,6 +11,8 @@
import java.util.concurrent.atomic.AtomicReference;
import java.util.logging.Handler;

import javax.annotation.Nonnull;

public final class TestUtils {
public static final Query EMPTY_QUERY = new Query() {
@Override public String queryDocument() {
Expand All @@ -31,6 +34,10 @@ public final class TestUtils {
@Override public Object wrapData(Data data) {
return data;
}

@Nonnull @Override public OperationName name() {
return null;
}
};

public static Looper createBackgroundLooper() throws Exception {
Expand Down