Skip to content

Commit

Permalink
Fixes: unit tests with syncGetRequest()
Browse files Browse the repository at this point in the history
  • Loading branch information
pantstamp committed May 23, 2024
1 parent 71b1a40 commit 0a696cc
Show file tree
Hide file tree
Showing 26 changed files with 81 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,9 @@ class ActivityLogRestClientTest {
eq(ActivitiesResponse::class.java),
eq(false),
any(),
eq(false))
eq(false),
customGsonBuilder = anyOrNull()
)
).thenReturn(response)
whenever(site.siteId).thenReturn(siteId)
return response
Expand All @@ -609,7 +611,9 @@ class ActivityLogRestClientTest {
eq(RewindStatusResponse::class.java),
eq(false),
any(),
eq(false))).thenReturn(response)
eq(false),
customGsonBuilder = anyOrNull()
)).thenReturn(response)
whenever(site.siteId).thenReturn(siteId)
return response
}
Expand Down Expand Up @@ -693,7 +697,9 @@ class ActivityLogRestClientTest {
eq(Array<BackupDownloadStatusResponse>::class.java),
eq(false),
any(),
eq(false))).thenReturn(response)
eq(false),
customGsonBuilder = anyOrNull()
)).thenReturn(response)
whenever(site.siteId).thenReturn(siteId)
return response
}
Expand All @@ -710,7 +716,9 @@ class ActivityLogRestClientTest {
eq(ActivityTypesResponse::class.java),
eq(false),
any(),
eq(false))
eq(false),
customGsonBuilder = anyOrNull()
)
).thenReturn(response)
return response
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -571,8 +571,8 @@ class CommentsRestClientTest {
eq(kclass),
any(),
any(),
any()

any(),
customGsonBuilder = anyOrNull()
)
).thenReturn(response)
return response
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import org.mockito.Mock
import org.mockito.junit.MockitoJUnitRunner
import org.mockito.kotlin.KArgumentCaptor
import org.mockito.kotlin.any
import org.mockito.kotlin.anyOrNull
import org.mockito.kotlin.argumentCaptor
import org.mockito.kotlin.eq
import org.mockito.kotlin.mock
Expand Down Expand Up @@ -397,7 +398,8 @@ class CardsRestClientTest {
eq(CardsResponse::class.java),
eq(false),
any(),
eq(false)
eq(false),
customGsonBuilder = anyOrNull()
)
).thenReturn(response)
whenever(site.siteId).thenReturn(siteId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import org.mockito.Mock
import org.mockito.junit.MockitoJUnitRunner
import org.mockito.kotlin.KArgumentCaptor
import org.mockito.kotlin.any
import org.mockito.kotlin.anyOrNull
import org.mockito.kotlin.argumentCaptor
import org.mockito.kotlin.eq
import org.mockito.kotlin.whenever
Expand Down Expand Up @@ -174,7 +175,8 @@ class ExperimentRestClientTest {
eq(FetchAssignmentsResponse::class.java),
eq(false),
any(),
eq(true)
eq(true),
customGsonBuilder = anyOrNull()
)
).thenReturn(response)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import org.mockito.Mock
import org.mockito.junit.MockitoJUnitRunner
import org.mockito.kotlin.KArgumentCaptor
import org.mockito.kotlin.any
import org.mockito.kotlin.anyOrNull
import org.mockito.kotlin.argumentCaptor
import org.mockito.kotlin.eq
import org.mockito.kotlin.mock
Expand Down Expand Up @@ -182,7 +183,8 @@ class FeatureFlagsRestClientTest {
eq(Map::class.java),
eq(false),
any(),
eq(false)
eq(false),
customGsonBuilder = anyOrNull()
)
).thenReturn(response)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import org.mockito.Mock
import org.mockito.junit.MockitoJUnitRunner
import org.mockito.kotlin.KArgumentCaptor
import org.mockito.kotlin.any
import org.mockito.kotlin.anyOrNull
import org.mockito.kotlin.argumentCaptor
import org.mockito.kotlin.eq
import org.mockito.kotlin.mock
Expand Down Expand Up @@ -137,7 +138,7 @@ class RemoteConfigRestClientTest {
eq(false),
any(),
eq(false),
any()
customGsonBuilder = anyOrNull()
)
).thenReturn(response)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import org.mockito.Mock
import org.mockito.junit.MockitoJUnitRunner
import org.mockito.kotlin.KArgumentCaptor
import org.mockito.kotlin.any
import org.mockito.kotlin.anyOrNull
import org.mockito.kotlin.argumentCaptor
import org.mockito.kotlin.eq
import org.mockito.kotlin.whenever
Expand Down Expand Up @@ -85,7 +86,8 @@ class PlanOffersRestClientTest {
eq(PlanOffersResponse::class.java),
eq(false),
any(),
eq(true)
eq(true),
customGsonBuilder = anyOrNull()
)
).thenReturn(response)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import org.mockito.Mock
import org.mockito.junit.MockitoJUnitRunner
import org.mockito.kotlin.KArgumentCaptor
import org.mockito.kotlin.any
import org.mockito.kotlin.anyOrNull
import org.mockito.kotlin.argumentCaptor
import org.mockito.kotlin.eq
import org.mockito.kotlin.whenever
Expand Down Expand Up @@ -90,7 +91,8 @@ class ProductsRestClientTest {
eq(ProductsResponse::class.java),
eq(false),
any(),
eq(false)
eq(false),
customGsonBuilder = anyOrNull()
)
).thenReturn(response)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ class ReactNativeWPComRestClientTest {
url,
params,
JsonElement::class.java,
true)
true,
)
).thenReturn(expectedRestCallResponse)

val actual = subject.getRequest(url, params, successHandler, errorHandler)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,8 @@ class ScanRestClientTest {
eq(ScanStateResponse::class.java),
eq(false),
any(),
eq(false)
eq(false),
customGsonBuilder = anyOrNull()
)
).thenReturn(response)
whenever(site.siteId).thenReturn(siteId)
Expand Down Expand Up @@ -506,7 +507,8 @@ class ScanRestClientTest {
eq(FixThreatsStatusResponse::class.java),
eq(false),
any(),
eq(false)
eq(false),
customGsonBuilder = anyOrNull()
)
).thenReturn(response)
return response
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,8 @@ class SiteRestClientTest {
eq(clazz),
any(),
any(),
any()
any(),
customGsonBuilder = anyOrNull()

)
).thenReturn(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ internal class XPostsRestClientTest {
mapOf("decode_html" to "true"),
Array<XPostSiteModel>::class.java,
true,
60000
60000,
)
)
.thenReturn(expected)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import org.mockito.Mock
import org.mockito.junit.MockitoJUnitRunner
import org.mockito.kotlin.KArgumentCaptor
import org.mockito.kotlin.any
import org.mockito.kotlin.anyOrNull
import org.mockito.kotlin.argumentCaptor
import org.mockito.kotlin.eq
import org.mockito.kotlin.isNull
Expand Down Expand Up @@ -510,7 +511,8 @@ class InsightsRestClientTest {
eq(kclass),
eq(cachingEnabled),
any(),
eq(false)
eq(false),
customGsonBuilder = anyOrNull()
)
).thenReturn(response)
whenever(site.siteId).thenReturn(siteId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import org.mockito.Mock
import org.mockito.junit.MockitoJUnitRunner
import org.mockito.kotlin.KArgumentCaptor
import org.mockito.kotlin.any
import org.mockito.kotlin.anyOrNull
import org.mockito.kotlin.argumentCaptor
import org.mockito.kotlin.eq
import org.mockito.kotlin.mock
Expand Down Expand Up @@ -101,7 +102,8 @@ class MostPopularRestClientTest {
eq(MostPopularResponse::class.java),
eq(true),
any(),
eq(false)
eq(false),
customGsonBuilder = anyOrNull()
)
).thenReturn(response)
whenever(site.siteId).thenReturn(siteId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import org.mockito.Mock
import org.mockito.junit.MockitoJUnitRunner
import org.mockito.kotlin.KArgumentCaptor
import org.mockito.kotlin.any
import org.mockito.kotlin.anyOrNull
import org.mockito.kotlin.argumentCaptor
import org.mockito.kotlin.eq
import org.mockito.kotlin.mock
Expand Down Expand Up @@ -118,7 +119,8 @@ class PostingActivityRestClientTest {
eq(PostingActivityResponse::class.java),
eq(true),
any(),
eq(false)
eq(false),
customGsonBuilder = anyOrNull()
)
).thenReturn(response)
whenever(site.siteId).thenReturn(siteId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import org.mockito.Mock
import org.mockito.junit.MockitoJUnitRunner
import org.mockito.kotlin.KArgumentCaptor
import org.mockito.kotlin.any
import org.mockito.kotlin.anyOrNull
import org.mockito.kotlin.argumentCaptor
import org.mockito.kotlin.eq
import org.mockito.kotlin.mock
Expand Down Expand Up @@ -98,7 +99,8 @@ class SummaryRestClientTest {
eq(SummaryResponse::class.java),
eq(false),
any(),
eq(false)
eq(false),
customGsonBuilder = anyOrNull()
)
).thenReturn(response)
whenever(site.siteId).thenReturn(siteId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import org.mockito.Mock
import org.mockito.junit.MockitoJUnitRunner
import org.mockito.kotlin.KArgumentCaptor
import org.mockito.kotlin.any
import org.mockito.kotlin.anyOrNull
import org.mockito.kotlin.argumentCaptor
import org.mockito.kotlin.eq
import org.mockito.kotlin.mock
Expand Down Expand Up @@ -144,7 +145,8 @@ class SubscribersRestClientTest {
eq(clazz),
eq(cachingEnabled),
any(),
eq(false)
eq(false),
customGsonBuilder = anyOrNull()
)
).thenReturn(response)
whenever(site.siteId).thenReturn(siteId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import org.mockito.Mock
import org.mockito.junit.MockitoJUnitRunner
import org.mockito.kotlin.KArgumentCaptor
import org.mockito.kotlin.any
import org.mockito.kotlin.anyOrNull
import org.mockito.kotlin.argumentCaptor
import org.mockito.kotlin.eq
import org.mockito.kotlin.isNull
Expand Down Expand Up @@ -172,7 +173,8 @@ class AuthorsRestClientTest {
eq(kclass),
eq(cachingEnabled),
any(),
eq(false)
eq(false),
customGsonBuilder = anyOrNull()
)
).thenReturn(response)
whenever(site.siteId).thenReturn(siteId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import org.mockito.Mock
import org.mockito.junit.MockitoJUnitRunner
import org.mockito.kotlin.KArgumentCaptor
import org.mockito.kotlin.any
import org.mockito.kotlin.anyOrNull
import org.mockito.kotlin.argumentCaptor
import org.mockito.kotlin.eq
import org.mockito.kotlin.isNull
Expand Down Expand Up @@ -218,7 +219,8 @@ class ClicksRestClientTest {
eq(kclass),
eq(cachingEnabled),
any(),
eq(false)
eq(false),
customGsonBuilder = anyOrNull()
)
).thenReturn(response)
whenever(site.siteId).thenReturn(siteId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import org.mockito.Mock
import org.mockito.junit.MockitoJUnitRunner
import org.mockito.kotlin.KArgumentCaptor
import org.mockito.kotlin.any
import org.mockito.kotlin.anyOrNull
import org.mockito.kotlin.argumentCaptor
import org.mockito.kotlin.eq
import org.mockito.kotlin.isNull
Expand Down Expand Up @@ -168,7 +169,8 @@ class CountryViewsRestClientTest {
eq(kclass),
eq(cachingEnabled),
any(),
eq(false)
eq(false),
customGsonBuilder = anyOrNull()
)
).thenReturn(response)
whenever(site.siteId).thenReturn(siteId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import org.mockito.Mock
import org.mockito.junit.MockitoJUnitRunner
import org.mockito.kotlin.KArgumentCaptor
import org.mockito.kotlin.any
import org.mockito.kotlin.anyOrNull
import org.mockito.kotlin.argumentCaptor
import org.mockito.kotlin.eq
import org.mockito.kotlin.isNull
Expand Down Expand Up @@ -172,7 +173,8 @@ class FileDownloadsRestClientTest {
eq(kclass),
eq(cachingEnabled),
any(),
eq(false)
eq(false),
customGsonBuilder = anyOrNull()
)
).thenReturn(response)
whenever(site.siteId).thenReturn(siteId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import org.mockito.Mock
import org.mockito.junit.MockitoJUnitRunner
import org.mockito.kotlin.KArgumentCaptor
import org.mockito.kotlin.any
import org.mockito.kotlin.anyOrNull
import org.mockito.kotlin.argumentCaptor
import org.mockito.kotlin.eq
import org.mockito.kotlin.isNull
Expand Down Expand Up @@ -168,7 +169,8 @@ class PostAndPageViewsRestClientTest {
eq(kclass),
eq(cachingEnabled),
any(),
eq(false)
eq(false),
customGsonBuilder = anyOrNull()
)
).thenReturn(response)
whenever(site.siteId).thenReturn(siteId)
Expand Down
Loading

0 comments on commit 0a696cc

Please sign in to comment.