CVS: junit-ant-tests/src/test/net/saff/ant FileMatchersTest.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/test/net/saff/ant
In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv3239/src/test/net/saff/ant
Added Files:
FileMatchersTest.java
Log Message:
initial check-in
--- NEW FILE: FileMatchersTest.java ---
package test.net.saff.ant;
import static net.saff.ant.FileMatchers.*;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import java.io.File;
import java.io.IOException;
import org.junit.After;
import org.junit.Test;
public class FileMatchersTest {
private File tempFile;
@After
public void deleteFiles() {
if (tempFile != null)
tempFile.delete();
}
private String newTempFilename() throws IOException {
tempFile = File.createTempFile("temp", null);
return tempFile.getAbsolutePath();
}
@Test
public void nameOfExistingFileIsCorrect() throws IOException {
assertThat(newTempFilename(), nameOfExistingFile());
}
@Test
public void tempFilenameIsDeleted() throws IOException {
String filename = newTempFilename();
deleteFiles();
assertThat(filename, not(nameOfExistingFile()));
}
@Test
public void nameOfExistingFileDescribesWell() {
assertThat(nameOfExistingFile().toString(), is("name of existing file"));
}
@Test
public void someFilesDontExist() throws IOException {
File file = File.createTempFile("test", "txt");
file.delete();
assertThat(file.getAbsolutePath(), not(nameOfExistingFile()));
}
}
-------------------------------------------------------------------------
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/