@@ -552,10 +552,16 @@ public void testApplyBgpPeersForVpc() throws ResourceUnavailableException {
552552 when (networkTopologyContext .retrieveNetworkTopology (dc )).thenReturn (networkTopology );
553553 doReturn (true ).when (networkTopology ).applyBgpPeers (any (), any (), any ());
554554
555- boolean result = virtualRouterElement .applyBgpPeers (vpc , null , bgpPeers );
555+ try (MockedStatic <CallContext > callContextMocked = Mockito .mockStatic (CallContext .class )) {
556+ CallContext callContextMock = Mockito .mock (CallContext .class );
557+ callContextMocked .when (CallContext ::current ).thenReturn (callContextMock );
558+ Mockito .when (callContextMock .getRequestEntityCache ()).thenReturn (new RequestEntityCache (Duration .ofSeconds (60 )));
559+
560+ boolean result = virtualRouterElement .applyBgpPeers (vpc , null , bgpPeers );
556561
557- Assert .assertTrue (result );
558- verify (networkTopology ).applyBgpPeers (any (), any (), any ());
562+ Assert .assertTrue (result );
563+ verify (networkTopology ).applyBgpPeers (any (), any (), any ());
564+ }
559565 }
560566
561567 @ Test
@@ -581,10 +587,10 @@ public void testApplyBgpPeersForNetwork() throws ResourceUnavailableException {
581587 callContextMocked .when (CallContext ::current ).thenReturn (callContextMock );
582588 Mockito .when (callContextMock .getRequestEntityCache ()).thenReturn (new RequestEntityCache (Duration .ofSeconds (60 )));
583589
584- boolean result = virtualRouterElement .applyBgpPeers (null , network , bgpPeers );
590+ boolean result = virtualRouterElement .applyBgpPeers (null , network , bgpPeers );
585591
586- Assert .assertTrue (result );
587- verify (networkTopology ).applyBgpPeers (any (), any (), any ());
592+ Assert .assertTrue (result );
593+ verify (networkTopology ).applyBgpPeers (any (), any (), any ());
588594 }
589595 }
590596}
0 commit comments