package com.github.rnowling.bps.datagenerator.generators.store;

import static org.junit.Assert.assertTrue;

import java.util.List;

import org.junit.Test;

import com.github.rnowling.bps.datagenerator.Constants;
import com.github.rnowling.bps.datagenerator.datamodels.inputs.ZipcodeRecord;
import com.github.rnowling.bps.datagenerator.datareaders.ZipcodeReader;
import com.github.rnowling.bps.datagenerator.generators.store.StoreLocationIncomePDF;

public class TestStoreLocationPopulationPDF
{

	@Test
	public void testProbability() throws Exception
	{
		ZipcodeReader reader = new ZipcodeReader();
		reader.setCoordinatesFile(Constants.COORDINATES_FILE);
		reader.setIncomesFile(Constants.INCOMES_FILE);
		reader.setPopulationFile(Constants.POPULATION_FILE);
		
		List<ZipcodeRecord> zipcodes = reader.readData();
		
		assertTrue(zipcodes.size() > 0);
		
		StoreLocationIncomePDF pdf = new StoreLocationIncomePDF(zipcodes, 100.0);
		
		for(ZipcodeRecord record : zipcodes)
		{
			assertTrue(pdf.probability(record) > 0.0);
		}
		
	}

}

@@ -98,24 +98,49 @@
 ssertTrue;%0A%0A
+import java.util.Arrays;%0A
 import java.
@@ -224,253 +224,101 @@
 tor.
-Constants;%0Aimport com.github.rnowling.bps.datagenerator.datamodels.inputs.ZipcodeRecord;%0Aimport com.github.rnowling.bps.datagenerator.datareaders.ZipcodeReader;%0Aimport com.github.rnowling.bps.datagenerator.generators.store.StoreLocationIncomePDF
+datamodels.Pair;%0Aimport com.github.rnowling.bps.datagenerator.datamodels.inputs.ZipcodeRecord
 ;%0A%0Ap
@@ -423,16 +423,21 @@
 on%0A%09%7B%0A%09%09
+List%3C
 ZipcodeR
@@ -441,214 +441,142 @@
 deRe
-ader reader = new ZipcodeReader();%0A%09%09reader.setCoordinatesFile(Constants.COORDINATES_FILE);%0A%09%09reader.setIncomesFile(Constants.INCOMES_FILE);%0A%09%09reader.setPopulationFile(Constants.POPULATION_FILE);
+cord%3E zipcodes = Arrays.asList(new ZipcodeRecord%5B%5D %7B%09%09%09%09%0A%09%09%09%09new ZipcodeRecord(%2211111%22, Pair.create(1.0, 1.0), 30000.0, 100),
 %0A%09%09
-%0A
 %09%09
-List%3C
+new 
 Zipc
@@ -588,75 +588,129 @@
 cord
-%3E zipcodes = reade
+(%2222222%22, Pai
 r.
+c
 rea
-dData();
+te(2.0, 2.0), 45000.0, 200),
 %0A%09%09
-%0A
 %09%09
-assertTrue(zipcodes.size() %3E 0
+new ZipcodeRecord(%2233333%22, Pair.create(3.0, 3.0), 60000.0, 300)%0A%09%09%09%09%7D
 );%0A%09

Remove file reader dependencies from TestStoreLocationPopulationPDF