package checkdep;

import static org.junit.Assert.*;

import java.util.Iterator;

import org.junit.Before;
import org.junit.Test;

import checkdep.check.Constraints;
import checkdep.check.JDependConstraintChecker;
import checkdep.parse.ExcludePackages;
import checkdep.parse.JDependImportParser;
import checkdep.parse.SourceDirectories;
import checkdep.value.violation.Violation;
import checkdep.value.violation.Violations;

public class CheckDepTest {

  @Before
  public void setUp() throws Exception {
  }

  @Test
  public void testExecute() {
    Constraints constraints = Constraints.builder()
        .add("checkdep", "checkdep.check")
        .add("checkdep", "checkdep.value.violation")
        .add("checkdep", "checkdep.parse")
        .add("checkdep.check", "checkdep.common")
        .add("checkdep.check", "checkdep.value.depend")
        .add("checkdep.check", "checkdep.value.violation")
        .add("checkdep.check", "com.google.common.collect")
        .add("checkdep.check", "jdepend.framework")
        .add("checkdep.common", "checkdep.value.depend")
        .add("checkdep.common", "jdepend.framework")
        .add("checkdep.parse", "checkdep.common")
        .add("checkdep.parse", "checkdep.value.depend")
        .add("checkdep.parse", "java.io")
        .add("checkdep.parse", "jdepend.framework")
        .add("checkdep.value.violation", "checkdep.value.depend")
        .build();
    CheckDep target = new CheckDep(
        new JDependImportParser(
            SourceDirectories.of(
                "target/classes"),
            ExcludePackages.of(
                "java.lang",
                "java.util",
                "org.apache.commons.lang3",
                "checkdep.util")),
            new JDependConstraintChecker(constraints));

    Violations res = target.execute();

    Iterator<Violation> it = res.iterator();
    assertFalse(res.toString(), it.hasNext());
  }
}

@@ -79,33 +79,8 @@
 r;%0A%0A
-import org.junit.Before;%0A
 impo
@@ -429,14 +429,12 @@
 %0A  @
-Before
+Test
 %0A  p
@@ -448,107 +448,380 @@
 oid 
-setUp() throws Exception %7B%0A  %7D%0A%0A  @Test%0A  public void testExecute() %7B%0A    Constraints constraints =
+testExecute() %7B%0A    CheckDep target = new CheckDep(%0A        new JDependImportParser(%0A            SourceDirectories.of(%0A                %22target/classes%22),%0A            ExcludePackages.of(%0A                %22java.lang%22,%0A                %22java.util%22,%0A                %22org.apache.commons.lang3%22,%0A                %22checkdep.util%22)),%0A        new JDependConstraintChecker(%0A           
  Con
@@ -839,16 +839,24 @@
 ilder()%0A
+        
         
@@ -886,24 +886,32 @@
 dep.check%22)%0A
+        
         .add
@@ -951,32 +951,40 @@
 ation%22)%0A        
+     
+   
 .add(%22checkdep%22,
@@ -1002,16 +1002,24 @@
 parse%22)%0A
+        
         
@@ -1060,32 +1060,40 @@
 ommon%22)%0A        
+  
+      
 .add(%22checkdep.c
@@ -1124,32 +1124,40 @@
 epend%22)%0A        
+       
+ 
 .add(%22checkdep.c
@@ -1191,32 +1191,40 @@
 ation%22)%0A        
+      
+  
 .add(%22checkdep.c
@@ -1259,32 +1259,40 @@
 llect%22)%0A        
+    
+    
 .add(%22checkdep.c
@@ -1319,32 +1319,40 @@
 ework%22)%0A        
+   
+     
 .add(%22checkdep.c
@@ -1384,32 +1384,40 @@
 epend%22)%0A        
+  
+      
 .add(%22checkdep.c
@@ -1445,32 +1445,40 @@
 ework%22)%0A        
+       
+ 
 .add(%22checkdep.p
@@ -1495,32 +1495,40 @@
 eckdep.common%22)%0A
+        
         .add(%22ch
@@ -1567,32 +1567,40 @@
 epend%22)%0A        
+    
+    
 .add(%22checkdep.p
@@ -1617,16 +1617,24 @@
 va.io%22)%0A
+        
         
@@ -1677,32 +1677,40 @@
 ework%22)%0A        
+ 
+       
 .add(%22checkdep.v
@@ -1763,16 +1763,24 @@
     
+        
 .build()
 ;%0A  
@@ -1779,369 +1779,8 @@
 ld()
-;%0A    CheckDep target = new CheckDep(%0A        new JDependImportParser(%0A            SourceDirectories.of(%0A                %22target/classes%22),%0A            ExcludePackages.of(%0A                %22java.lang%22,%0A                %22java.util%22,%0A                %22org.apache.commons.lang3%22,%0A                %22checkdep.util%22)),%0A            new JDependConstraintChecker(constraints
 ));%0A

test refactoring