1 21 22 package net.sourceforge.cobertura.reporting.html.files; 23 24 import java.io.File ; 25 import java.io.IOException ; 26 27 import junit.framework.TestCase; 28 29 public class CopyFilesTest extends TestCase 30 { 31 private final static String basedir = (System.getProperty("basedir") != null) 32 ? System.getProperty("basedir") 33 : "./"; 34 private final static File tmpDir = new File (basedir, "/build/test/tmp"); 35 36 public void setUp() 37 { 38 tmpDir.mkdirs(); 39 } 40 41 private final static void removeDir(File dir) 42 { 43 File files[] = dir.listFiles(); 44 for (int i = 0; i < files.length; i++) 45 { 46 if (files[i].isDirectory()) 47 removeDir(files[i]); 48 else 49 files[i].delete(); 50 } 51 dir.delete(); 52 } 53 54 public void tearDown() 55 { 56 removeDir(tmpDir); 57 } 58 59 public static void testCopy() throws IOException 60 { 61 CopyFiles.copy(tmpDir); 62 assertTrue(new File (tmpDir, "help.html").isFile()); 63 assertTrue(new File (tmpDir, "index.html").isFile()); 64 65 File cssDir = new File (tmpDir, "css"); 66 assertTrue(cssDir.isDirectory()); 67 assertTrue(new File (cssDir, "help.css").isFile()); 68 assertTrue(new File (cssDir, "main.css").isFile()); 69 assertTrue(new File (cssDir, "sortabletable.css").isFile()); 70 assertTrue(new File (cssDir, "source-viewer.css").isFile()); 71 assertTrue(new File (cssDir, "tooltip.css").isFile()); 72 73 File imagesDir = new File (tmpDir, "images"); 74 assertTrue(imagesDir.isDirectory()); 75 assertTrue(new File (imagesDir, "blank.png").isFile()); 76 assertTrue(new File (imagesDir, "downsimple.png").isFile()); 77 assertTrue(new File (imagesDir, "upsimple.png").isFile()); 78 79 File jsDir = new File (tmpDir, "js"); 80 assertTrue(jsDir.isDirectory()); 81 assertTrue(new File (jsDir, "customsorttypes.js").isFile()); 82 assertTrue(new File (jsDir, "popup.js").isFile()); 83 assertTrue(new File (jsDir, "sortabletable.js").isFile()); 84 assertTrue(new File (jsDir, "stringbuilder.js").isFile()); 85 } 86 } | Popular Tags |