1 19 20 package org.netbeans.upgrade; 21 22 import java.util.Set ; 23 import org.netbeans.junit.NbTestCase; 24 25 29 public final class IncludeExcludeTest extends NbTestCase { 30 private Set includeExclude; 31 32 public IncludeExcludeTest (String name) { 33 super (name); 34 } 35 36 protected void setUp() throws Exception { 37 super.setUp(); 38 39 String reader = "# ignore comment\n" + 40 "include one/file.txt\n" + 41 "include two/dir/.*\n" + 42 "\n" + 43 "exclude two/dir/sub/.*\n"; 44 45 includeExclude = IncludeExclude.create (new java.io.StringReader (reader)); 46 } 47 48 public void testOneFileIsThere () { 49 assertTrue (includeExclude.contains ("one/file.txt")); 50 } 51 52 public void testDoesNotContainRoot () { 53 assertFalse (includeExclude.contains ("")); 54 } 55 56 public void testContainsSomethingInDir () { 57 assertTrue (includeExclude.contains ("two/dir/a.file")); 58 } 59 60 public void testContainsSomethingUnderTheDir () { 61 assertTrue (includeExclude.contains ("two/dir/some/folder/a.file")); 62 } 63 64 public void testDoesNotContainSubDir () { 65 assertFalse (includeExclude.contains ("two/dir/sub/not.there")); 66 } 67 68 public void testWrongContentDetected () { 69 try { 70 IncludeExclude.create (new java.io.StringReader ("some strange line")); 71 fail ("Should throw exception"); 72 } catch (java.io.IOException ex) { 73 } 74 } 75 } 76 | Popular Tags |