29
29
30
30
import java .util .Collections ;
31
31
import java .util .EnumSet ;
32
+ import java .util .Map ;
32
33
import java .util .UUID ;
33
34
34
35
import static ch .cyberduck .core .googledrive .DriveHomeFinderService .MYDRIVE_FOLDER ;
@@ -39,14 +40,20 @@ public class DriveMetadataFeatureTest extends AbstractDriveTest {
39
40
40
41
@ Test
41
42
public void setMetadata () throws Exception {
42
- final Path home = DriveHomeFinderService .MYDRIVE_FOLDER ;
43
- final Path test = new Path (home , UUID .randomUUID ().toString (), EnumSet .of (Path .Type .file ));
43
+ final Path test = new Path (DriveHomeFinderService .MYDRIVE_FOLDER , UUID .randomUUID ().toString (), EnumSet .of (Path .Type .file ));
44
44
final DriveFileIdProvider fileid = new DriveFileIdProvider (session );
45
- new DriveTouchFeature (session , fileid ).touch (test , new TransferStatus ());
46
- assertEquals (Collections .emptyMap (), new DriveMetadataFeature (session , fileid ).getMetadata (test ));
47
- new DriveMetadataFeature (session , fileid ).setMetadata (test , Collections .singletonMap ("test" , "t" ));
48
- assertEquals (Collections .singletonMap ("test" , "t" ), new DriveMetadataFeature (session , fileid ).getMetadata (test ));
49
- new DriveDeleteFeature (session , fileid ).delete (Collections .<Path >singletonList (test ), new DisabledLoginCallback (), new Delete .DisabledCallback ());
45
+ final TransferStatus status = new TransferStatus ();
46
+ new DriveTouchFeature (session , fileid ).touch (test , status );
47
+ final DriveMetadataFeature feature = new DriveMetadataFeature (session , fileid );
48
+ assertEquals (Collections .emptyMap (), feature .getMetadata (test ));
49
+ feature .setMetadata (test , Collections .singletonMap ("test" , "t" ));
50
+ final Map <String , String > metadata = feature .getMetadata (test );
51
+ assertEquals (Collections .singletonMap ("test" , "t" ), metadata );
52
+ test .attributes ().setMetadata (metadata );
53
+ feature .setMetadata (test , status .setMetadata (Collections .emptyMap ()));
54
+ assertFalse (status .getResponse ().getMetadata ().containsKey ("test" ));
55
+ assertFalse (feature .getMetadata (test ).containsKey ("test" ));
56
+ new DriveDeleteFeature (session , fileid ).delete (Collections .singletonList (test ), new DisabledLoginCallback (), new Delete .DisabledCallback ());
50
57
}
51
58
52
59
@ Test
0 commit comments