1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package net.sf.webphotos.netbeans.project;
17
18 import org.junit.After;
19 import org.junit.AfterClass;
20 import static org.junit.Assert.*;
21 import org.junit.Before;
22 import org.junit.BeforeClass;
23 import org.junit.Test;
24 import org.netbeans.api.project.Project;
25 import org.netbeans.spi.project.ProjectState;
26 import org.openide.filesystems.FileObject;
27 import org.openide.filesystems.FileSystem;
28 import org.openide.filesystems.FileUtil;
29
30
31
32
33
34 public class WebPhotosProjectFactoryTest {
35
36 private FileObject baseProjectTest;
37 private FileSystem memoryFileSystem;
38
39 @BeforeClass
40 public static void setUpClass() {
41 }
42
43 @AfterClass
44 public static void tearDownClass() {
45 }
46
47 @Before
48 public void setUp() throws Exception {
49 memoryFileSystem = FileUtil.createMemoryFileSystem();
50 baseProjectTest = memoryFileSystem.getRoot();
51 for (String node : WebPhotosProjectFactory.PROJECT_ARCHIVES) {
52 FileUtil.createData(baseProjectTest, node);
53 }
54 assertNotNull(baseProjectTest);
55 }
56
57 @After
58 public void tearDown() {
59 }
60
61
62
63
64 @Test
65 public void testIsProject() {
66 System.out.println("isProject");
67 FileObject projectDirectory = baseProjectTest;
68 WebPhotosProjectFactory instance = new WebPhotosProjectFactory();
69 boolean expResult = true;
70 boolean result = instance.isProject(projectDirectory);
71 assertEquals(expResult, result);
72 }
73
74
75
76
77 @Test
78 public void testLoadProject() throws Exception {
79 System.out.println("loadProject");
80 FileObject dir = baseProjectTest;
81 ProjectState state = new ProjectState() {
82
83 @Override
84 public void markModified() {
85 throw new UnsupportedOperationException("Not supported yet.");
86 }
87
88 @Override
89 public void notifyDeleted() throws IllegalStateException {
90 throw new UnsupportedOperationException("Not supported yet.");
91 }
92 };
93 WebPhotosProjectFactory instance = new WebPhotosProjectFactory();
94 Project result = instance.loadProject(dir, state);
95 assertNotNull(result);
96 }
97
98
99
100
101 public void testSaveProject() throws Exception {
102 System.out.println("saveProject");
103 Project project = null;
104 WebPhotosProjectFactory instance = new WebPhotosProjectFactory();
105 instance.saveProject(project);
106
107 fail("The test case is a prototype.");
108 }
109 }