1 package ch
.cyberduck
.core
;
3 import ch
.cyberduck
.core
.serializer
.PathAttributesDictionary
;
7 import static org
.junit
.Assert
.*;
12 public class PathAttributesTest
extends AbstractTestCase
{
15 public void testGetAsDictionary() throws Exception
{
16 PathAttributes attributes
= new PathAttributes();
17 attributes
.setSize(3L);
18 attributes
.setModificationDate(5343L);
19 assertEquals(attributes
, new PathAttributesDictionary().deserialize(attributes
.serialize(SerializerFactory
.get())));
20 assertEquals(attributes
.hashCode(), new PathAttributesDictionary().deserialize(attributes
.serialize(SerializerFactory
.get())).hashCode());
24 public void testPermissions() throws Exception
{
25 PathAttributes attributes
= new PathAttributes();
26 assertNull(attributes
.getOwner());
27 assertNull(attributes
.getGroup());
28 assertNotNull(attributes
.getPermission());
29 assertEquals(Permission
.EMPTY
, attributes
.getPermission());
30 assertEquals(Acl
.EMPTY
, attributes
.getAcl());
34 public void testSerialize() throws Exception
{
35 PathAttributes attributes
= new PathAttributes();
36 attributes
.setPermission(new Permission(644));
37 attributes
.setDuplicate(true);
38 attributes
.setVersionId("v-1");
39 attributes
.setModificationDate(System
.currentTimeMillis());
40 assertEquals(attributes
, new PathAttributesDictionary().deserialize(attributes
.serialize(SerializerFactory
.get())));
41 assertEquals(attributes
.hashCode(), new PathAttributesDictionary().deserialize(attributes
.serialize(SerializerFactory
.get())).hashCode());
45 public void testEquals() throws Exception
{
46 assertTrue(new PathAttributes().equals(new PathAttributes()));
47 final PathAttributes r1
= new PathAttributes();
49 final PathAttributes r2
= new PathAttributes();
51 assertFalse(r1
.equals(r2
));