3232import  java .io .IOException ;
3333import  java .io .InputStream ;
3434import  java .net .MalformedURLException ;
35+ import  java .util .Date ;
3536import  java .util .HashMap ;
3637import  java .util .Map ;
3738import  java .util .UUID ;
@@ -201,14 +202,16 @@ public class CreateMedia {
201202    private  final  String  fetchUrl  = "https://example.com" ;
202203    private  final  String  description  = "desc" ;
203204    private  final  String  itemId  = "itemId" ;
205+     private  final  Long  uploadedTimestampInSeconds  = 1718697600L ; // 2024-06-18 00:00:00 UTC 
204206
205207    public  Stream <Object > provideMediaObjectsInTempStore () {
208+       Date  uploadedTime  = new  Date (uploadedTimestampInSeconds  * 1000 );
206209      return  Stream .of (
207-           new  PhotoModel (itemName , fetchUrl , description , "mediaType" , itemId , null , true ),
208-           new  VideoModel (itemName , fetchUrl , description , "format" , itemId , null , true , null ));
210+           new  PhotoModel (itemName , fetchUrl , description , "mediaType" , itemId , null , true ,  uploadedTime ),
211+           new  VideoModel (itemName , fetchUrl , description , "format" , itemId , null , true , uploadedTime ));
209212    }
210213
211-     public  Stream <Object > provideMediaObjectsWithoutDescriptionInTempStore () {
214+     public  Stream <Object > provideMediaObjectsWithoutDescriptionAndUploadedTimeInTempStore () {
212215      return  Stream .of (
213216          new  PhotoModel (itemName , fetchUrl , null , "mediaType" , itemId , null , true ),
214217          new  VideoModel (itemName , fetchUrl , null , "format" , itemId , null , true , null ));
@@ -321,9 +324,9 @@ public void shouldThrowExceptionIfFailedToGetStream(DownloadableFile item)
321324    }
322325
323326    @ ParameterizedTest (
324-         name  = "shouldSendPostRequestWithCorrectFormBodyWithDescription  [{index}] {0}" )
327+         name  = "shouldSendPostRequestWithCorrectFormBodyWithDescriptionAndUploadedTime  [{index}] {0}" )
325328    @ MethodSource ("provideMediaObjectsInTempStore" )
326-     public  void  shouldSendPostRequestWithCorrectFormBodyWithDescription (DownloadableFile  item )
329+     public  void  shouldSendPostRequestWithCorrectFormBodyWithDescriptionAndUploadedTime (DownloadableFile  item )
327330        throws  IOException  {
328331      byte [] mockImage  = new  byte [] {1 , 2 , 3 };
329332      InputStream  mockInputStream  = new  ByteArrayInputStream (mockImage );
@@ -357,7 +360,8 @@ public void shouldSendPostRequestWithCorrectFormBodyWithDescription(Downloadable
357360              "service" , exportingService ,
358361              "item_id" , itemId ,
359362              "title" , itemName ,
360-               "description" , description );
363+               "description" , description ,
364+               "uploaded_time" , String .valueOf (uploadedTimestampInSeconds ));
361365
362366      for  (MultipartBody .Part  part  : multipartBody .parts ()) {
363367        String  partName  =
@@ -379,8 +383,8 @@ public void shouldSendPostRequestWithCorrectFormBodyWithDescription(Downloadable
379383    }
380384
381385    @ ParameterizedTest (
382-         name  = "shouldSendPostRequestWithCorrectFormBodyWithoutDescription  [{index}] {0}" )
383-     @ MethodSource ("provideMediaObjectsWithoutDescriptionInTempStore " )
386+         name  = "shouldSendPostRequestWithCorrectFormBodyWithoutDescriptionAndUploadedTime  [{index}] {0}" )
387+     @ MethodSource ("provideMediaObjectsWithoutDescriptionAndUploadedTimeInTempStore " )
384388    public  void  shouldSendPostRequestWithCorrectFormBodyWithoutDescription (DownloadableFile  item )
385389        throws  IOException  {
386390      byte [] mockImage  = new  byte [] {1 , 2 , 3 };
0 commit comments