/*
 * Project to resolve 2D cutting stock problem for Discreet Optimizations course at Polytech Lyon
 * Copyright (C) 2015.  CARON Antoine and CHAUSSENDE Adrien
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.polytech4A.cuttingstock.core.model;

import junit.framework.TestCase;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import java.util.ArrayList;
import java.util.Collections;

public class PatternTest {

    private Pattern pattern;

    @Before
    public void setUp() throws Exception {
        ArrayList<Box> boxes = new ArrayList<Box>();
        pattern = new Pattern(new Vector(1, 1), boxes);
        boxes.add(new Box(new Vector(933.0, 372.0), 6));
        boxes.add(new Box(new Vector(893.0, 307.0), 2));
        boxes.add(new Box(new Vector(727.0, 333.0), 5));
    }

    @After
    public void tearDown() throws Exception {
        pattern.getAmounts().clear();
        pattern = null;
    }

    @Test
    public void testGetBoxes() throws Exception {
        ArrayList<Box> result = pattern.getBoxes();
        TestCase.assertEquals(13, result.size());
        for (Box b : result) {
            TestCase.assertEquals(1, Collections.frequency(result, b));
        }
    }
}
@@ -1101,16 +1101,45 @@
 ttern;%0A%0A
+    private Box boxeToTest;%0A%0A
     @Bef
@@ -1142,16 +1142,16 @@
 @Before%0A
-
     publ
@@ -1298,38 +1298,41 @@
 s);%0A        boxe
-s.add(
+ToTest = 
 new Box(new Vect
@@ -1351,16 +1351,46 @@
 2.0), 6)
+;%0A        boxes.add(boxeToTest
 );%0A     
@@ -1624,16 +1624,43 @@
 = null;%0A
+        boxeToTest = null;%0A
     %7D%0A%0A 
@@ -1824,43 +1824,8 @@
 ));%0A
-        for (Box b : result) %7B%0A    
     
@@ -1850,17 +1850,17 @@
 tEquals(
-1
+6
 , Collec
@@ -1888,21 +1888,20 @@
 t, b
-));%0A        %7D
+oxeToTest));
 %0A   

Fix Unit Test