Fix transcript in transfer window.
[cyberduck.git] / test / ch / cyberduck / core / PathAttributesTest.java
blobe27a510321a6d8a35ee6a12194e4895e2350c3d9
1 package ch.cyberduck.core;
3 import ch.cyberduck.core.serializer.PathAttributesDictionary;
5 import org.junit.Test;
7 import static org.junit.Assert.*;
9 /**
10 * @version $Id$
12 public class PathAttributesTest extends AbstractTestCase {
14 @Test
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());
23 @Test
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());
33 @Test
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());
44 @Test
45 public void testEquals() throws Exception {
46 assertTrue(new PathAttributes().equals(new PathAttributes()));
47 final PathAttributes r1 = new PathAttributes();
48 r1.setRegion("r1");
49 final PathAttributes r2 = new PathAttributes();
50 r2.setRegion("r2");
51 assertFalse(r1.equals(r2));