@@ -185,4 +185,30 @@ void givenExportFileNotFoundWhenDownloadExportFileThenThrowException() {
185
185
Mockito .verify (userAuthorizationServiceMock ).checkUserAuthorization (organizationId , user , accessToken );
186
186
}
187
187
188
+ @ Test
189
+ void givenExportFileNotReadyWhenDownloadExportFileThenThrowException () {
190
+ String accessToken = "TOKEN" ;
191
+ Long organizationId = 1L ;
192
+ Long exportFileId = 10L ;
193
+
194
+ UserOrganizationRoles userTestRole = new UserOrganizationRoles ();
195
+ userTestRole .setRoles (List .of ("TEST" , "ADMIN" ));
196
+ userTestRole .setOrganizationId (organizationId );
197
+ UserInfo user = new UserInfo ();
198
+ user .setOrganizations (List .of (userTestRole ));
199
+ user .setMappedExternalUserId ("TEST" );
200
+
201
+ ExportFile exportFile = new ExportFile ();
202
+ exportFile .setOrganizationId (organizationId );
203
+ exportFile .setStatus (ExportFile .StatusEnum .REQUESTED );
204
+ exportFile .setOperatorExternalId ("TEST" );
205
+
206
+ Mockito .when (exportFileServiceMock .getExportFile (exportFileId , accessToken )).thenReturn (exportFile );
207
+
208
+ Executable exec = () -> exportFileService .downloadExportFile (organizationId , exportFileId , user , accessToken );
209
+
210
+ Assertions .assertThrows (FileNotFoundException .class , exec );
211
+ Mockito .verify (userAuthorizationServiceMock ).checkUserAuthorization (organizationId , user , accessToken );
212
+ }
213
+
188
214
}
0 commit comments