01: package liquibase.ant;
02:
03: import liquibase.FileOpener;
04: import liquibase.AbstractFileOpenerTest;
05: import org.apache.tools.ant.Project;
06: import org.apache.tools.ant.types.Path;
07: import static org.junit.Assert.*;
08: import org.junit.Test;
09:
10: import java.io.InputStream;
11: import java.net.URL;
12: import java.util.Enumeration;
13:
14: /**
15: * Tests for {@link AntFileOpener}
16: */
17: public class AntFileOpenerTest extends AbstractFileOpenerTest {
18:
19: /**
20: * @see liquibase.AbstractFileOpenerTest#createFileOpener()
21: */
22: @Override
23: protected FileOpener createFileOpener() {
24: Project project = new Project();
25: return new AntFileOpener(project, new Path(project));
26: }
27:
28: @Test
29: public void getResourceAsStream() throws Exception {
30: InputStream inputStream = fileOpener
31: .getResourceAsStream("liquibase/ant/AntFileOpenerTest.class");
32: assertNotNull(inputStream);
33: }
34:
35: @Test
36: public void getResourceAsStreamNonExistantFile() throws Exception {
37: assertNull(fileOpener
38: .getResourceAsStream("non/existant/file.txt"));
39: }
40:
41: @Test
42: public void getResources() throws Exception {
43: Enumeration<URL> resources = fileOpener
44: .getResources("liquibase/ant");
45: assertNotNull(resources);
46: }
47: }
|