Creating Project Instances
Sometimes you want to test a Task. But in order to do that, you need a valid Project object. You could put it into a build file, but that can be a bit tedious and perhaps difficult to test when all you want to do is use a JUnit test. In these instances, the ProjectInstanceHelper is a life-saver, as you can create a valid Project instance without a build file and run your tests through that.The usage of ProjectInstanceHelper is pretty straightforward:
project =
ProjectInstanceHelper.getProjectInstance(Project.MSG_DEBUG);
project.setName("my-project");
project.setBaseDir(new File("someplace"));
You can now use this project instance along with any task instance you might be testing, using TaskHelper to initialize the task correctly using the project instance.
If you choose not to specifying the logging level, it defaults to INFO, just like the ant command line.
/rsh tech

