@@ -79,27 +79,7 @@ void testCreateProjectTimeout() throws Exception {
7979 handler .setThrottle (10 , TimeUnit .MILLISECONDS );
8080 handler .setTimeout (500 , TimeUnit .MILLISECONDS );
8181
82- assertThrows (Exception .class , () -> handler .waitWithContext (), handler .TimoutErrorMessage );
83- }
84-
85- // Non GenericOpenAPIError error
86- @ Test
87- void testCreateProjectNonOpenAPIError () throws Exception {
88- // Return containerId == null and LifecycleState == CREATING
89- GetProjectResponse creatingResponse = new GetProjectResponse ();
90- creatingResponse .setContainerId (null );
91- creatingResponse .setLifecycleState (null );
92- when (apiClient .getProject (containerId , false )).thenReturn (creatingResponse );
93-
94- AsyncActionHandler <GetProjectResponse > handler =
95- ResourcemanagerWait .createProjectWaitHandler (apiClient , containerId );
96- handler .setSleepBeforeWait (0 , TimeUnit .SECONDS );
97- handler .setThrottle (10 , TimeUnit .MILLISECONDS );
98- handler .setTimeout (100 , TimeUnit .MILLISECONDS );
99- handler .setTempErrRetryLimit (2 );
100-
101- Exception thrown = assertThrows (Exception .class , () -> handler .waitWithContext (), "" );
102- assertEquals (thrown .getMessage (), handler .NonGenericAPIErrorMessage );
82+ assertThrows (Exception .class , handler ::waitWithContext , handler .TimoutErrorMessage );
10383 }
10484
10585 // GenericOpenAPIError not in RetryHttpErrorStatusCodes
@@ -117,10 +97,7 @@ void testCreateProjectOpenAPIError() throws Exception {
11797 handler .setTempErrRetryLimit (2 );
11898
11999 Exception thrown =
120- assertThrows (
121- Exception .class ,
122- () -> handler .waitWithContext (),
123- apiException .getMessage ());
100+ assertThrows (Exception .class , handler ::waitWithContext , apiException .getMessage ());
124101 assertEquals (thrown .getMessage (), handler .TimoutErrorMessage );
125102 }
126103
@@ -139,10 +116,7 @@ void testOpenAPIErrorTimeoutBadGateway() throws Exception {
139116 handler .setTempErrRetryLimit (2 );
140117
141118 Exception thrown =
142- assertThrows (
143- Exception .class ,
144- () -> handler .waitWithContext (),
145- apiException .getMessage ());
119+ assertThrows (Exception .class , handler ::waitWithContext , apiException .getMessage ());
146120 assertEquals (thrown .getMessage (), handler .TemporaryErrorMessage );
147121 }
148122
@@ -199,37 +173,6 @@ void testDeleteProjectSuccessDeleting() throws Exception {
199173 verify (apiClient , times (2 )).getProject (containerId , false );
200174 }
201175
202- @ Test
203- void testDeleteProjectSuccessContainerIdNull () throws Exception {
204- // First call returns "ACTIVE", second call returns containerId = null
205- GetProjectResponse activeResponse = new GetProjectResponse ();
206- activeResponse .setContainerId (containerId );
207- activeResponse .setLifecycleState (LifecycleState .ACTIVE );
208-
209- GetProjectResponse deletingResponse = new GetProjectResponse ();
210- deletingResponse .setContainerId (null );
211- deletingResponse .setLifecycleState (LifecycleState .DELETING );
212-
213- AtomicInteger callCount = new AtomicInteger (0 );
214- when (apiClient .getProject (containerId , false ))
215- .thenAnswer (
216- invocation -> {
217- if (callCount .getAndIncrement () < 1 ) {
218- return activeResponse ;
219- }
220- return deletingResponse ;
221- });
222-
223- AsyncActionHandler <Void > handler =
224- ResourcemanagerWait .deleteProjectWaitHandler (apiClient , containerId );
225- handler .setSleepBeforeWait (0 , TimeUnit .SECONDS );
226- handler .setThrottle (10 , TimeUnit .MILLISECONDS );
227- handler .setTimeout (2 , TimeUnit .SECONDS );
228-
229- handler .waitWithContext ();
230- verify (apiClient , times (2 )).getProject (containerId , false );
231- }
232-
233176 @ Test
234177 void testDeleteProjectSuccessNotFoundExc () throws Exception {
235178 // Trigger API Exception
0 commit comments