@@ -498,7 +498,7 @@ public void onComplete(boolean success) {
498498 assertEquals (Test .GENERAL_INT , fileManager .getBytesAvailable ());
499499 }
500500
501- public void testFileUploadFailure (){
501+ public void testFileUploadFailure () {
502502 ISdl internalInterface = mock (ISdl .class );
503503
504504 doAnswer (onListFilesSuccess ).when (internalInterface ).sendRPCRequest (any (ListFiles .class ));
@@ -521,12 +521,16 @@ public void onComplete(boolean success) {
521521 });
522522 }
523523
524- public void testFileUploadForStaticIcon (){
524+ /**
525+ * Testing uploadFile for a staticIcon, verifying that it doesn't actually upload.
526+ */
527+ public void testFileUploadForStaticIcon () {
525528 ISdl internalInterface = mock (ISdl .class );
526529
527- doAnswer (onListFilesSuccess ).when (internalInterface ).sendRPCRequest (any (ListFiles .class ));
530+ doAnswer (onListFilesSuccess ).when (internalInterface ).sendRPC (any (ListFiles .class ));
528531
529- final FileManager fileManager = new FileManager (internalInterface , mTestContext );
532+ FileManagerConfig fileManagerConfig = new FileManagerConfig ();
533+ final FileManager fileManager = new FileManager (internalInterface , mTestContext , fileManagerConfig );
530534 fileManager .start (new CompletionListener () {
531535 @ Override
532536 public void onComplete (boolean success ) {
@@ -540,6 +544,70 @@ public void onComplete(boolean success) {
540544 });
541545 }
542546 });
547+ verify (internalInterface , times (1 )).sendRPC (any (RPCMessage .class ));
548+ }
549+
550+ /**
551+ * Testing uploadFiles for staticIcons, verifying that it doesn't actually upload.
552+ */
553+ public void testMultipleFileUploadsForStaticIcon () {
554+ ISdl internalInterface = mock (ISdl .class );
555+
556+ doAnswer (onListFilesSuccess ).when (internalInterface ).sendRPC (any (ListFiles .class ));
557+ doAnswer (onListFileUploadSuccess ).when (internalInterface ).sendRequests (any (List .class ), any (OnMultipleRequestListener .class ));
558+
559+ FileManagerConfig fileManagerConfig = new FileManagerConfig ();
560+ final FileManager fileManager = new FileManager (internalInterface , mTestContext , fileManagerConfig );
561+ fileManager .start (new CompletionListener () {
562+ @ Override
563+ public void onComplete (boolean success ) {
564+ assertTrue (success );
565+ SdlArtwork artwork = new SdlArtwork (StaticIconName .ALBUM );
566+ SdlArtwork artwork2 = new SdlArtwork (StaticIconName .FILENAME );
567+ List <SdlArtwork > testStaticIconUpload = new ArrayList <>();
568+ testStaticIconUpload .add (artwork );
569+ testStaticIconUpload .add (artwork2 );
570+ fileManager .uploadFiles (testStaticIconUpload , new MultipleFileCompletionListener () {
571+ @ Override
572+ public void onComplete (Map <String , String > errors ) {
573+ assertTrue (errors == null );
574+ }
575+ });
576+ }
577+ });
578+ verify (internalInterface , times (0 )).sendRequests (any (List .class ), any (OnMultipleRequestListener .class ));
579+ }
580+
581+ /**
582+ * Testing uploadFiles for static icons and nonStatic icons in the same list.
583+ */
584+ public void testMultipleFileUploadsForPartialStaticIcon () {
585+ ISdl internalInterface = mock (ISdl .class );
586+
587+ doAnswer (onListFilesSuccess ).when (internalInterface ).sendRPC (any (ListFiles .class ));
588+ doAnswer (onListFileUploadSuccess ).when (internalInterface ).sendRequests (any (List .class ), any (OnMultipleRequestListener .class ));
589+
590+ FileManagerConfig fileManagerConfig = new FileManagerConfig ();
591+ final FileManager fileManager = new FileManager (internalInterface , mTestContext , fileManagerConfig );
592+ fileManager .start (new CompletionListener () {
593+ @ Override
594+ public void onComplete (boolean success ) {
595+ assertTrue (success );
596+ SdlArtwork artwork = new SdlArtwork (StaticIconName .ALBUM );
597+ SdlArtwork artwork2 = new SdlArtwork (StaticIconName .FILENAME );
598+ List <SdlFile > testFileuploads = new ArrayList <>();
599+ testFileuploads .add (artwork );
600+ testFileuploads .add (artwork2 );
601+ testFileuploads .add (validFile );
602+ fileManager .uploadFiles (testFileuploads , new MultipleFileCompletionListener () {
603+ @ Override
604+ public void onComplete (Map <String , String > errors ) {
605+ assertTrue (errors == null );
606+ }
607+ });
608+ }
609+ });
610+ verify (internalInterface , times (1 )).sendRequests (any (List .class ), any (OnMultipleRequestListener .class ));
543611 }
544612
545613 public void testInvalidSdlFileInput (){
0 commit comments