package cl.fatman.capital.fund;

import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;

import java.time.LocalDate;
import java.util.Map;

public class ExtractDataTest {
	
	private ExtractData efData;
	private ReadProperties fProperties;
	private FundType type;
	
	@Before
	public void setUp() {
		fProperties = new ReadProperties("fund.properties");
		fProperties.getProperties();
		String userAgent = fProperties.getUserAgent();
		String fundLink = fProperties.getFundLink();
		String baseQuery = fProperties.getFundQuery();
		String ufLink = fProperties.getUfLink();
		efData = new ExtractData(fundLink, userAgent, baseQuery, ufLink);
		type = new FundType(1, "Deuda < 90 días");
	}
	
	@Test
	public void fundDataNotNullTest() {
		LocalDate queryDate = LocalDate.of(2016, 1, 1);
		assertNotNull("Fund map should not be null", efData.getFundData(queryDate, type));
	}
	
	@Test
	public void fundDataNotEmptyTest() {
		LocalDate queryDate = LocalDate.of(2016, 1, 1);
		Map<Fund, Double>  tmpMap = efData.getFundData(queryDate, type);
		assertFalse("Fund map should not be empty.", tmpMap.isEmpty()); 
	}
	
	@Test
	public void fundDataNullTest() {
		LocalDate queryDate = LocalDate.of(2016, 1, 1);
		efData.setFundLink("");
		efData.setUserAgent("");
		assertNull("Fund map should be null.", efData.getFundData(queryDate, type));
	}
	
	@Test
	public void fundDataEmptyTest() {
		LocalDate queryDate = LocalDate.of(1970, 1, 1);
		Map<Fund, Double>  tmpMap = efData.getFundData(queryDate, type);
		assertTrue("Fund map should be empty.", tmpMap.isEmpty()); 
	}
	
	@Test
	public void getFomentUnitDataNotNullTest() {
		assertNotNull("Foment unit map should not be null", efData.getFomentUnitData(2016)); 
	}
	
	@Test
	public void getFomentUnitDataNullTest() {
		assertNull("Foment unit map should not be null", efData.getFomentUnitData(1910)); 
	}
}
@@ -26,16 +26,56 @@
 .fund;%0A%0A
+import static org.hamcrest.Matchers.*;%0A%0A
 import s
@@ -748,32 +748,285 @@
 %22);%0A%09%7D%0A%09%0A%09@Test%0A
+%09public void getFundDataTest() %7B%0A%09%09LocalDate queryDate = LocalDate.of(2016, 1, 1);%0A%09%09Map%3CFund, Double%3E  fundMap = efData.getFundData(queryDate, type);%0A%09%09assertThat(%22Fund map should not be greater than 10.%22, fundMap.size(), greaterThan(10));%0A%09%7D%0A%09%0A%09@Test%0A
 %09public void fun
@@ -1294,35 +1294,36 @@
 %3CFund, Double%3E  
-tmp
+fund
 Map = efData.get
@@ -1388,35 +1388,36 @@
 not be empty.%22, 
-tmp
+fund
 Map.isEmpty()); 
@@ -1763,19 +1763,20 @@
 ouble%3E  
-tmp
+fund
 Map = ef
@@ -1856,11 +1856,12 @@
 .%22, 
-tmp
+fund
 Map.
@@ -1911,24 +1911,316 @@
 mentUnitData
+Test() %7B%0A%09%09LocalDate ufDate = LocalDate.now();%0A%09%09Map%3CString, FomentUnit%3E ufMap = efData.getFomentUnitData(2016);%0A%09%09assertThat(%22Foment unit map should not be greater than the days of the year.%22, ufMap.size(), %0A%09%09%09%09   greaterThan(ufDate.getDayOfYear()));%0A%09%7D%0A%09%0A%09@Test%0A%09public void fomentUnitData
 NotNullTest(
@@ -2328,36 +2328,33 @@
 st%0A%09public void 
-getF
+f
 omentUnitDataNul

Improve the quality of ExtractData class tests.