package cl.fatman.capital.fund;

import static org.hamcrest.Matchers.*;

import static org.junit.Assert.*;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;

import java.util.ArrayList;
import java.util.List;

public class ControllerTest {
	
	private static Controller control;
	private static PersistenceData persistence;
	
	@BeforeClass
	public static void setUp() {
		control = Controller.getInstance();
		control.setUp();
		List<FundType> ftList = new ArrayList<FundType>();
		FundType type = new FundType(1, "Deuda < 90 días");
		ftList.add(type);
		persistence = PersistenceData.getInstance();
		persistence.insertObjectList(ftList);
	}
	
	@AfterClass
	public static void tearDown() {
		control.tearDown();
	}
	
	@Test
	public void storeFundDataTest() {
		control.storeFundData();
		List<?> fundList = persistence.selectAllObjects("from Fund", Fund.class);
		List<?> fundRateList = persistence.selectAllObjects("from FundRate", FundRate.class);
		assertThat("Fund rate list should be greater than fund list.", fundRateList.size(), greaterThan(fundList.size()));
	}
}
@@ -447,24 +447,103 @@
 ol.setUp();%0A
+%09%09persistence = PersistenceData.getInstance();%0A%09%09//Insert a initial fund type.%0A
 %09%09List%3CFundT
@@ -583,16 +583,16 @@
 ype%3E();%0A
-
 %09%09FundTy
@@ -661,55 +661,8 @@
 e);%0A
-%09%09persistence = PersistenceData.getInstance();%0A
 %09%09pe
@@ -782,16 +782,16 @@
 %0A%09@Test%0A
-
 %09public 
@@ -844,16 +844,43 @@
 Data();%0A
+%09%09control.storeFundData();%0A
 %09%09List%3C?

Update and improve the successful cases for the Controller.