1 17 18 package org.apache.tools.ant.types; 19 20 import org.apache.tools.ant.BuildException; 21 22 26 public class DirSetTest extends AbstractFileSetTest { 27 28 public DirSetTest(String name) { 29 super(name); 30 } 31 32 protected AbstractFileSet getInstance() { 33 return new DirSet(); 34 } 35 36 public void testFileSetIsNoDirSet() { 37 DirSet ds = (DirSet) getInstance(); 38 ds.setProject(getProject()); 39 FileSet fs = new FileSet(); 40 fs.setProject(getProject()); 41 getProject().addReference("dummy", fs); 42 ds.setRefid(new Reference("dummy")); 43 try { 44 ds.getDir(getProject()); 45 fail("DirSet created from FileSet reference"); 46 } catch (BuildException e) { 47 assertEquals("dummy doesn\'t denote a DirSet", e.getMessage()); 48 } 49 50 ds = (DirSet) getInstance(); 51 ds.setProject(getProject()); 52 getProject().addReference("dummy2", ds); 53 fs.setRefid(new Reference("dummy2")); 54 try { 55 fs.getDir(getProject()); 56 fail("FileSet created from DirSet reference"); 57 } catch (BuildException e) { 58 assertEquals("dummy2 doesn\'t denote a FileSet", e.getMessage()); 59 } 60 } 61 62 } 63 | Popular Tags |