@Test @PrepareForTest({URL.class, MParticleApiClientImpl.class, MPUtility.class}) public void testConfigRequestWhileThrottled() throws Exception { setup(); PowerMockito.mockStatic(MPUtility.class); for (MParticleBaseClientImpl.Endpoint endpoint: MParticleBaseClientImpl.Endpoint.values()) { client.getRequestHandler().setNextRequestTime(endpoint, System.currentTimeMillis() + 1000); } Mockito.when(mockConnection.getResponseCode()).thenReturn(200); JSONObject response = new JSONObject(); response.put("test", "value"); Mockito.when(MPUtility.getJsonResponse(mockConnection)).thenReturn(response); ArgumentCaptor<JSONObject> captor = ArgumentCaptor.forClass(JSONObject.class); client.fetchConfig(); Mockito.verify(configManager).updateConfig(captor.capture()); assertEquals(response, captor.getValue()); }
@Override public void fetchConfig() throws IOException, MPConfigException { fetchConfig(false); }
MParticleApiClientImpl extends MParticleBaseClientImpl implements MParticleApiClient { @Override public void fetchConfig() throws IOException, MPConfigException { fetchConfig(false); } }
MParticleApiClientImpl extends MParticleBaseClientImpl implements MParticleApiClient { @Override public void fetchConfig() throws IOException, MPConfigException { fetchConfig(false); } MParticleApiClientImpl(ConfigManager configManager, SharedPreferences sharedPreferences, Context context); }
MParticleApiClientImpl extends MParticleBaseClientImpl implements MParticleApiClient { @Override public void fetchConfig() throws IOException, MPConfigException { fetchConfig(false); } MParticleApiClientImpl(ConfigManager configManager, SharedPreferences sharedPreferences, Context context); @Override void fetchConfig(); void fetchConfig(boolean force); JSONObject fetchAudiences(); int sendMessageBatch(String message); @Override AliasNetworkResponse sendAliasRequest(String message); void setCookies(JSONObject serverCookies); JSONObject getCookies(); }
MParticleApiClientImpl extends MParticleBaseClientImpl implements MParticleApiClient { @Override public void fetchConfig() throws IOException, MPConfigException { fetchConfig(false); } MParticleApiClientImpl(ConfigManager configManager, SharedPreferences sharedPreferences, Context context); @Override void fetchConfig(); void fetchConfig(boolean force); JSONObject fetchAudiences(); int sendMessageBatch(String message); @Override AliasNetworkResponse sendAliasRequest(String message); void setCookies(JSONObject serverCookies); JSONObject getCookies();  }