package com.fishercoder;

import com.fishercoder.solutions._40;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.junit.BeforeClass;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class _40Test {
  private static _40.Solution1 solution1;
  private static int[] candidates;
  private static List<List<Integer>> expected;

  @BeforeClass
  public static void setup() {
    solution1 = new _40.Solution1();
  }

  @Test
  public void test1() {
    candidates = new int[] {10, 1, 2, 7, 6, 1, 5};
    expected = new ArrayList<>();
    expected.add(Arrays.asList(1, 1, 6));
    expected.add(Arrays.asList(1, 2, 5));
    expected.add(Arrays.asList(1, 7));
    expected.add(Arrays.asList(2, 6));
    assertEquals(expected, solution1.combinationSum2(candidates, 8));
  }
}

@@ -61,35 +61,8 @@
 40;%0A
-import java.util.ArrayList;
 %0Aimp
@@ -106,16 +106,17 @@
 l.List;%0A
+%0A
 import o
@@ -230,16 +230,18 @@
 0Test %7B%0A
+  
   privat
@@ -274,16 +274,18 @@
 ution1;%0A
+  
   privat
@@ -311,16 +311,49 @@
 idates;%0A
+    private static int target;%0A  
   privat
@@ -392,16 +392,18 @@
 ected;%0A%0A
+  
   @Befor
@@ -409,16 +409,18 @@
 reClass%0A
+  
   public
@@ -446,16 +446,20 @@
 ) %7B%0A    
+    
 solution
@@ -487,21 +487,25 @@
 ();%0A
+  
   %7D%0A%0A
+  
   @Test%0A
   pu
@@ -500,16 +500,18 @@
   @Test%0A
+  
   public
@@ -530,16 +530,20 @@
 ) %7B%0A    
+    
 candidat
@@ -556,17 +556,16 @@
 ew int%5B%5D
- 
 %7B10, 1, 
@@ -580,24 +580,28 @@
  1, 5%7D;%0A    
+    
 expected = n
@@ -602,116 +602,120 @@
 ed =
- new
  Array
-List%3C%3E();%0A    expected.add(Arrays.asList(1, 1, 6));%0A    expected.add(Arrays.asList(1, 2, 5
+s.asList((Arrays.asList(1, 1, 6)), Arrays.asList(1, 2, 5), Arrays.asList(1, 7), Arrays.asList(2, 6
 ));%0A    
 expe
@@ -714,82 +714,642 @@
     
-expected.add(Arrays.asList(1, 7));%0A    expected.add(Arrays.asList(2, 6));%0A
+    target = 8;%0A        assertEquals(expected, solution1.combinationSum2(candidates, target));%0A    %7D%0A%0A    @Test%0A    public void test2() %7B%0A        candidates = new int%5B%5D%7B1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1%7D;%0A        expected = Arrays.asList(Arrays.asList(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1));%0A        target = 30;%0A    
     
@@ -1413,13 +1413,20 @@
 es, 
-8
+target
 ));%0A
+  
   %7D%0A

refactor 40