@@ -7,9 +7,11 @@ import com.apollographql.apollo.api.Error
77import com.apollographql.apollo.api.Operation
88import com.apollographql.apollo.exception.CacheMissException
99import com.apollographql.cache.normalized.CacheManager
10+ import com.apollographql.cache.normalized.FetchPolicy
1011import com.apollographql.cache.normalized.allowCachedErrors
1112import com.apollographql.cache.normalized.allowCachedPartialResults
1213import com.apollographql.cache.normalized.cacheManager
14+ import com.apollographql.cache.normalized.fetchPolicy
1315import com.apollographql.cache.normalized.memory.MemoryCacheFactory
1416import com.apollographql.cache.normalized.noCache
1517import com.apollographql.cache.normalized.onlyIfCached
@@ -27,7 +29,6 @@ import kotlin.test.Test
2729import kotlin.test.assertEquals
2830import kotlin.test.assertIs
2931import kotlin.test.assertNull
30- import kotlin.test.assertNull
3132
3233class CacheOptionsTest {
3334 private lateinit var mockServer: MockServer
@@ -178,7 +179,6 @@ class CacheOptionsTest {
178179 ApolloClient .Builder ()
179180 .serverUrl(mockServer.url())
180181 .cacheManager(cacheManager)
181- .cachePolicyResponseMapper(cachePolicyResponseMapper)
182182 .build()
183183 .use { apolloClient ->
184184 val networkResult1 = apolloClient.query(UserByCategoryQuery (Category (0 , " test" )))
@@ -215,7 +215,9 @@ class CacheOptionsTest {
215215 )
216216
217217 val cacheResult = apolloClient.query(UserByCategoryQuery (Category (1 , " test2" )))
218- .fetchPolicy(FetchPolicy .CacheOnly )
218+ .onlyIfCached(true )
219+ .allowCachedErrors(true )
220+ .allowCachedPartialResults(true )
219221 .execute()
220222 assertEquals(
221223 networkResult2.data,
@@ -383,6 +385,7 @@ class CacheOptionsTest {
383385 val cacheResult = apolloClient.query(UsersQuery (listOf (" 1" , " 2" , " 3" , " 4" , " 5" , " 6" , " 7" )))
384386 .onlyIfCached(true )
385387 .allowCachedErrors(true )
388+ .allowCachedPartialResults(true )
386389 .execute()
387390 assertEquals(
388391 UsersQuery .Data (
@@ -485,7 +488,6 @@ class CacheOptionsTest {
485488 ApolloClient .Builder ()
486489 .serverUrl(mockServer.url())
487490 .cacheManager(cacheManager)
488- .cachePolicyResponseMapper(cachePolicyResponseMapper)
489491 .build()
490492 .use { apolloClient ->
491493 val networkResult1 = apolloClient.query(AllUsersQuery ())
@@ -521,7 +523,9 @@ class CacheOptionsTest {
521523 )
522524
523525 val cacheResult1 = apolloClient.query(AllUsersQuery ())
524- .fetchPolicy(FetchPolicy .CacheOnly )
526+ .onlyIfCached(true )
527+ .allowCachedErrors(true )
528+ .allowCachedPartialResults(true )
525529 .execute()
526530 assertEquals(
527531 AllUsersQuery .Data (
@@ -554,6 +558,8 @@ class CacheOptionsTest {
554558
555559 val cacheResult2 = apolloClient.query(UsersQuery (listOf (" 1" , " 2" , " 3" , " 4" )))
556560 .fetchPolicy(FetchPolicy .CacheOnly )
561+ .allowCachedErrors(true )
562+ .allowCachedPartialResults(true )
557563 .execute()
558564 assertEquals(
559565 UsersQuery .Data (
0 commit comments