@@ -1455,15 +1455,19 @@ public void getCachedObjectShouldAddUuidAndChQueryParamsBeforeSendingWhenChIsPre
14551455 MultiMap .caseInsensitiveMultiMap ().add ("Header" , "Value" ),
14561456 "body" );
14571457
1458- given (httpClient .get (eq ("http://cache-service/cache?uuid=key&ch=ch" ), any (), anyLong ()))
1459- .willReturn (Future .succeededFuture (response ));
1458+ given (httpClient .get (any (), any (), anyLong ())).willReturn (Future .succeededFuture (response ));
14601459
14611460 // when
14621461 final Future <HttpClientResponse > result = target .getCachedObject ("key" , "ch" , timeout );
14631462
14641463 // then
14651464 assertThat (result .result ()).isEqualTo (response );
14661465 verify (metrics ).updateVtrackCacheReadRequestTime (anyLong (), eq (MetricName .ok ));
1466+ final ArgumentCaptor <String > urlCaptor = ArgumentCaptor .forClass (String .class );
1467+ verify (httpClient ).get (urlCaptor .capture (), any (), anyLong ());
1468+ assertThat (urlCaptor .getValue ())
1469+ .startsWith ("http://cache-service/cache?" )
1470+ .contains ("uuid=key" , "ch=ch" );
14671471 }
14681472
14691473 @ Test
@@ -1487,13 +1491,13 @@ public void getCachedObjectShouldAddUuidQueryParamsBeforeSendingWhenChIsAbsent()
14871491
14881492 @ Test
14891493 public void getCachedObjectShouldAddUuidQueryParamsToInternalBeforeSendingWhenChIsAbsent ()
1490- throws MalformedURLException {
1494+ throws MalformedURLException , URISyntaxException {
14911495
14921496 // given
14931497 target = new CoreCacheService (
14941498 httpClient ,
1495- new URL ("http://cache-service/cache" ),
1496- new URL ("http://internal-cache-service/cache" ),
1499+ new URI ("http://cache-service/cache" ). toURL ( ),
1500+ new URI ("http://internal-cache-service/cache" ). toURL ( ),
14971501 "http://cache-service-host/cache?uuid=" ,
14981502 100L ,
14991503 "ApiKey" ,
@@ -1525,12 +1529,7 @@ public void getCachedObjectShouldAddUuidQueryParamsToInternalBeforeSendingWhenCh
15251529 @ Test
15261530 public void getCachedObjectShouldNotLogErrorMetricsWhenCacheIsNotReached () {
15271531 // given
1528- final HttpClientResponse response = HttpClientResponse .of (
1529- 200 ,
1530- MultiMap .caseInsensitiveMultiMap ().add ("Header" , "Value" ),
1531- "body" );
1532-
1533- given (httpClient .get (eq ("http://cache-service/cache?uuid=key&ch=ch" ), any (), anyLong ()))
1532+ given (httpClient .get (any (), any (), anyLong ()))
15341533 .willReturn (Future .failedFuture (new TimeoutException ("Timeout" )));
15351534
15361535 // when
@@ -1549,8 +1548,7 @@ public void getCachedObjectShouldHandleErrorResponse() {
15491548 null ,
15501549 jacksonMapper .encodeToString (CacheErrorResponse .builder ().message ("Resource not found" ).build ()));
15511550
1552- given (httpClient .get (eq ("http://cache-service/cache?uuid=key&ch=ch" ), any (), anyLong ()))
1553- .willReturn (Future .succeededFuture (response ));
1551+ given (httpClient .get (any (), any (), anyLong ())).willReturn (Future .succeededFuture (response ));
15541552
15551553 // when
15561554 final Future <HttpClientResponse > result = target .getCachedObject ("key" , "ch" , timeout );
@@ -1565,8 +1563,7 @@ public void getCachedObjectShouldFailWhenErrorResponseCanNotBeParsed() {
15651563 // given
15661564 final HttpClientResponse response = HttpClientResponse .of (404 , null , "Resource not found" );
15671565
1568- given (httpClient .get (eq ("http://cache-service/cache?uuid=key&ch=ch" ), any (), anyLong ()))
1569- .willReturn (Future .succeededFuture (response ));
1566+ given (httpClient .get (any (), any (), anyLong ())).willReturn (Future .succeededFuture (response ));
15701567
15711568 // when
15721569 final Future <HttpClientResponse > result = target .getCachedObject ("key" , "ch" , timeout );
0 commit comments