Permalink
Browse files

Merge branch '4.10' of git://github.com/KentBeck/junit into merge_pul…

…lreq_228

Fixed merge conflict.

Conflicts:
	acknowledgements.txt
  • Loading branch information...
neekfenwick committed Sep 9, 2011
2 parents 2ef140b + 84d0e8a commit c78c9cb48cf55cac76506ca5e7e3c0c091c6a626
View
@@ -87,11 +87,14 @@
2011 Apr 29
reinholdfuereder@github: bug report, test, and fix for GH-38:
ParentRunner filtering
-<<<<<<< HEAD
2011 Apr 29
Markus Keller (mkeller@github): Report for GH-187:
Unintentional dependency on Java 6
+2011 May 05
+ leet3lite.junit@soodonims.com: (github#228)
+ Added feature assertions for java.lang.Comparable in org.junit.Assert
+
2011 May 31
Kevin Cooney (kcooney@github): Patches for filtering test suites:
copy List returned by getChildren() before mutating it;
@@ -113,6 +116,6 @@
2011 Jul 28
electrickery, Stefan Birkner: Fixed typo in JavaDoc (github#134).
-2011 May 05
- leet3lite.junit@soodonims.com: (github#228)
- Added feature assertions for java.lang.Comparable in org.junit.Assert
+
+2011 Aug 10
+ rodolfoliviero@github and JoseRibeiro@github: feature to create recursive temporary folders.
@@ -59,9 +59,12 @@ public File newFile(String fileName) throws IOException {
/**
* Returns a new fresh folder with the given name under the temporary folder.
*/
- public File newFolder(String folderName) {
- File file= new File(folder, folderName);
- file.mkdir();
+ public File newFolder(String... folderNames) {
+ File file = folder;
+ for (String folderName : folderNames) {
+ file = new File(file, folderName);
+ file.mkdir();
+ }
return file;
}
@@ -39,9 +39,36 @@ public void tempFolderIsDeleted() {
@Test
public void testUsingTempFolder() throws IOException {
- createdFile= folder.newFolder("subfolder");
- new File(createdFile, "a.txt").createNewFile();
- assertTrue(createdFile.exists());
+ String subfolder = "subfolder";
+ String filename = "a.txt";
+ createdFile= folder.newFolder(subfolder);
+ new File(createdFile, filename).createNewFile();
+
+ File expectedFile = new File(folder.getRoot(), join(subfolder, filename));
+
+ assertTrue(expectedFile.exists());
+ }
+
+ @Test
+ public void testUsingTempTreeFolders() throws IOException {
+ String subfolder = "subfolder";
+ String anotherfolder = "anotherfolder";
+ String filename = "a.txt";
+
+ createdFile = folder.newFolder(subfolder, anotherfolder);
+ new File(createdFile, filename).createNewFile();
+
+ File expectedFile = new File(folder.getRoot(), join(subfolder, anotherfolder, filename));
+
+ assertTrue(expectedFile.exists());
+ }
+
+ private String join(String... folderNames) {
+ StringBuilder path = new StringBuilder();
+ for (String folderName : folderNames) {
+ path.append(File.separator).append(folderName);
+ }
+ return path.toString();
}
}

0 comments on commit c78c9cb

Please sign in to comment.