1 4 package com.tc.test; 5 6 import java.io.File ; 7 import java.io.FileNotFoundException ; 8 import java.io.IOException ; 9 10 13 public class DataDirectoryHelper extends BaseDirectoryHelper { 14 15 public DataDirectoryHelper(Class theClass) throws IOException { 16 this(theClass, TestConfigObject.getInstance().dataDirectoryRoot()); 17 } 18 19 DataDirectoryHelper(Class theClass, String directoryPath) { 21 super(theClass, directoryPath); 22 } 23 24 protected File fetchDirectory() throws IOException { 25 ClassBasedDirectoryTree tree = new ClassBasedDirectoryTree(getRoot()); 26 File theDirectory = tree.getDirectory(getTargetClass()); 27 if (!theDirectory.exists()) throw new FileNotFoundException ("No data directory '" + theDirectory.getAbsolutePath() 28 + "' exists."); 29 return theDirectory; 30 } 31 32 public File getFile(String path) throws IOException { 33 File theFile = super.getFile(path); 34 if (!theFile.exists()) throw new FileNotFoundException ("No file '" + theFile.getAbsolutePath() + "' exists."); 35 return theFile; 36 } 37 } | Popular Tags |