1 package org.ogf.saga.namespace;
2
3 import org.junit.Assert;
4 import org.junit.Test;
5 import org.ogf.saga.error.DoesNotExistException;
6 import org.ogf.saga.namespace.abstracts.AbstractData;
7 import org.ogf.saga.url.URL;
8 import org.ogf.saga.url.URLFactory;
9
10
11
12
13
14
15
16
17
18
19
20
21
22 public abstract class EntryTest extends AbstractData {
23 protected EntryTest(String protocol) throws Exception {
24 super(protocol);
25 }
26
27 @Test
28 public void test_getURL() throws Exception {
29 URL expected = m_fileUrl;
30 Assert.assertEquals(
31 expected.toString(),
32 m_file.getURL().toString());
33 }
34
35 @Test
36 public void test_getCWD() throws Exception {
37 URL expected = URLFactory.createURL(m_subDirUrl.toString());
38 expected.setFragment(null);
39 Assert.assertEquals(
40 expected.toString(),
41 m_file.getCWD().toString());
42 }
43
44 @Test
45 public void test_getName() throws Exception {
46 Assert.assertEquals(
47 DEFAULT_FILENAME,
48 m_file.getName().getPath());
49 }
50
51 @Test(expected = DoesNotExistException.class)
52 public void test_unexisting() throws Exception {
53 NSFactory.createNSEntry(m_session, createURL(m_subDirUrl, "unexisting.txt"), Flags.NONE.getValue());
54 }
55 }