### Question:
CacheCheck { public static CheckResult checkProxyCache(Cache<Proxy> cache, String serviceId) { try { cache.get(serviceId); return new CheckResult(PROXY_CACHE_CHECK, Status.UP, "Proxy found"); } catch (ThreeScaleAdapterException e) { LOG.error(APIM_3002.pattern(), e); return new CheckResult(PROXY_CACHE_CHECK, Status.DOWN, "No proxy found"); } } private  CacheCheck(); static CheckResult checkProxyCache(Cache<Proxy> cache, String serviceId);  }### Answer:
@Test public void checkProxyCache() throws IOException, InterruptedException { JsonNode returnValue = new ObjectMapper().readTree( "{\"proxy_config\":" + "{\"content\" :" + "{\"proxy\" :" + "{\"api_backend\":\"backend\"}" + "}" + "}" + "}"); when(mockedConfigurationLoader.loadProxyConfig(eq(SERVICE_ID), any(Boolean.class))) .thenReturn(returnValue); CheckResult check = CacheCheck.checkProxyCache(proxyCache, SERVICE_ID); assertTrue(check.isUp()); assertEquals(Status.UP, check.getStatus()); }
@Test public void negativeCheckProxyCache() { when(mockedConfigurationLoader.loadProxyConfig(eq("invalidKey"), any(Boolean.class))).thenThrow(new ThreeScaleAdapterException("error")); CheckResult check = CacheCheck.checkProxyCache(proxyCache, "invalidKey"); assertFalse(check.isUp()); assertEquals(Status.DOWN, check.getStatus()); }