### Question:
ConfigurationLoader { public JsonNode loadProxyConfig(String serviceId, boolean loadFromOfflineCache) { String proxySettings = doLoadProxyConfig(serviceId, loadFromOfflineCache); try { return new ObjectMapper().readTree(proxySettings); } catch (Exception e) { throw new ThreeScaleAdapterException(APIM_3018.pattern(), e); } } ConfigurationLoader(OfflineConfigurationCacheRepo repo,
                               EmergencyModeState emergencyModeState,
                               ThreeScaleAdminCommunicationComponent threeScaleAdminCommunicationComponent,
                               ThreeScaleBackendCommunicationComponent threeScaleBackendCommunicationComponent); Client loadPlanConfig(String serviceId, String clientId, boolean loadFromOfflineCache); JsonNode loadMappingRulesConfig(String serviceId, boolean loadFromOfflineCache); JsonNode loadMetricConfig(String serviceId, boolean loadFromOfflineCache); JsonNode loadProxyConfig(String serviceId, boolean loadFromOfflineCache);  }### Answer:
@Test public void successfulLoadProxyConfiguration() { when(mockedThreeScaleAdminCommunicationComponent.loadProxyConfig(eq(SERVICE_ID))).thenReturn("{\"id\": 1}"); JsonNode jsonNode = testee.loadProxyConfig(SERVICE_ID, false); assertThat(jsonNode.get("id").asText(), is("1")); }
@Test(expected = RuntimeException.class) public void exceptionWhileloadProxyConfigConfiguration() { when(mockedThreeScaleAdminCommunicationComponent.loadProxyConfig(eq(SERVICE_ID))).thenThrow(new RuntimeException()); testee.loadProxyConfig(SERVICE_ID, false); }
@Test public void exceptionWhileloadProxyConfigConfigurationWithCache() { when(mockedThreeScaleAdminCommunicationComponent.loadProxyConfig(eq(SERVICE_ID))).thenThrow(new RuntimeException()); when(mockedOfflineConfigurationCacheRepo.findProxyConfig(eq(SERVICE_ID))).thenReturn("{\"id\": 1}"); JsonNode jsonNode = testee.loadProxyConfig(SERVICE_ID, true); verify(mockedEmergencyModeState).setConfigurationSuccessfulLoaded(eq(PROXY), eq(false)); assertThat(jsonNode.get("id").asText(), is("1")); }