### Question:
ApiWatch { public boolean isApiWatchRequest(String token, HttpMethod httpMethod) { return isApiWatchRequest(token, httpMethod != null ? httpMethod.name() : null); } ApiWatch(ApimAdapterConfig adapterConfig, OfflineConfigurationCacheRepo offlineConfigurationCacheRepo, TokenToParsedTokenCache tokenToParsedTokenCache, OperationMode operationMode); boolean isApiWatchRequest(String token, HttpMethod httpMethod); boolean isApiWatchRequest(String token, String httpMethod); boolean isApiWatchRequest(OAuthToken token, String httpMethod); void writeResponse(HttpServletResponse httpResponse); String buildResponse(); String buildResponse(String responseContent); String pingBackend(String token, String targetUrl); static final int HTTP_STATUS_OK; static final String RESPONSE_CONTENT_TYPE; static final String QUERY_PARAM_NAME_TARGET_URL; }### Answer:
@Test public void isApiWatchRequest() { WireMock.reset(); StubGenerator.instantiateStubForSbbPublicTokenIssuer(); StubGenerator.instantiateStubForSbbPublicTokenIssuerJwks(); final TokenToParsedTokenCache tokenToParsedTokenCache = new TokenToParsedTokenCache(apimAdapterConfig, restConfig, OfflineConfigurationCacheRepo.disabled()); final ApiWatch apiWatch = new ApiWatch(apimAdapterConfig, OfflineConfigurationCacheRepo.disabled(), tokenToParsedTokenCache, OperationMode.ADAPTER_JAVA); final String apiWatchClientToken = TokenGenerator.getInstance().generateBearerToken("api-watch-client", 30_000); final String someOtherClientToken = TokenGenerator.getInstance().generateBearerToken("some-other-client", 30_000); assertTrue(apiWatch.isApiWatchRequest(apiWatchClientToken, "GET")); assertTrue(apiWatch.isApiWatchRequest(apiWatchClientToken, HttpMethod.GET)); assertFalse(apiWatch.isApiWatchRequest(apiWatchClientToken, HttpMethod.PUT)); assertTrue(apiWatch.isApiWatchRequest(tokenToParsedTokenCache.parseToken(apiWatchClientToken), "GET")); assertFalse(apiWatch.isApiWatchRequest(tokenToParsedTokenCache.parseToken(apiWatchClientToken), "PUT")); assertFalse(apiWatch.isApiWatchRequest(tokenToParsedTokenCache.parseToken(someOtherClientToken), "GET")); assertFalse(apiWatch.isApiWatchRequest(tokenToParsedTokenCache.parseToken(someOtherClientToken), "PUT")); }