CVS: junit-ant-tests/src/net/saff/ant BuildFile.java, NONE, 1.1 FileMatchers.java, NONE, 1.1

David Saff <[email protected]> Thu, 05 Jul 2007 13:58:28 -0700
Newsgroups gmane.comp.java.junit.devel
Message-ID <[email protected]>
Update of /cvsroot/junit/junit-ant-tests/src/net/saff/ant
In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv3239/src/net/saff/ant

Added Files:
	BuildFile.java FileMatchers.java 
Log Message:
initial check-in

--- NEW FILE: BuildFile.java ---
package net.saff.ant;

import java.io.File;

import org.apache.tools.ant.Project;
import org.apache.tools.ant.ProjectHelper;

public class BuildFile {
	private final String fileName;

	public BuildFile(String fileName) {
		this.fileName = fileName;
	}

	public static BuildFile fromFile(String fileName) {
		return new BuildFile(fileName);
	}

	public Project parse() {
		return initializedProject(new File(fileName));
	}

	protected Project initializedProject(File file) {
		Project project = new Project();
		project.init();
		ProjectHelper.configureProject(project, file);		
		return project;
	}
}
--- NEW FILE: FileMatchers.java ---
package net.saff.ant;

import java.io.File;

import net.saff.theories.matchers.api.MethodNamedMatcher;

import org.hamcrest.Matcher;

public class FileMatchers {
	public static Matcher<String> nameOfExistingFile() {
		return new MethodNamedMatcher<String>() {
			public boolean matches(Object item) {
				return new File((String) item).exists();
			}
		};
	}
}


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/