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

import static org.junit.Assert.assertTrue;

import java.util.ArrayList;
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.datamodels.outputs.Store;
import com.github.rnowling.bps.datagenerator.datareaders.ZipcodeReader;
import com.github.rnowling.bps.datagenerator.framework.SeedFactory;
import com.github.rnowling.bps.datagenerator.framework.samplers.Sampler;
import com.github.rnowling.bps.datagenerator.generators.customer.CustomerLocationPDF;
import com.github.rnowling.bps.datagenerator.generators.store.StoreSamplerBuilder;

public class TestCustomerLocationPDF
{

	@Test
	public void testProbability() throws Exception
	{
		ZipcodeReader zipcodeReader = new ZipcodeReader();
		zipcodeReader.setCoordinatesFile(Constants.COORDINATES_FILE);
		zipcodeReader.setIncomesFile(Constants.INCOMES_FILE);
		zipcodeReader.setPopulationFile(Constants.POPULATION_FILE);
		List<ZipcodeRecord> zipcodes = zipcodeReader.readData();
		
		SeedFactory factory = new SeedFactory(1234);
		
		StoreSamplerBuilder storeSamplerBuilder = new StoreSamplerBuilder(zipcodes, factory);
		Sampler<Store> storeSampler = storeSamplerBuilder.build();
		
		List<Store> stores = new ArrayList<Store>();
		for(int i = 0; i < 10; i++)
		{
			Store store = storeSampler.sample();
			stores.add(store);
		}
		
		CustomerLocationPDF customerLocationPDF = new CustomerLocationPDF(zipcodes, stores, 
					Constants.AVERAGE_CUSTOMER_STORE_DISTANCE);
		
		double prob = customerLocationPDF.probability(zipcodes.get(0));
		
		assertTrue(prob > 0.0);
	}

}

@@ -461,318 +461,8 @@
 der;
-%0Aimport com.github.rnowling.bps.datagenerator.framework.SeedFactory;%0Aimport com.github.rnowling.bps.datagenerator.framework.samplers.Sampler;%0Aimport com.github.rnowling.bps.datagenerator.generators.customer.CustomerLocationPDF;%0Aimport com.github.rnowling.bps.datagenerator.generators.store.StoreSamplerBuilder;
 %0A%0Apu
@@ -858,210 +858,8 @@
 %0A%09%09%0A
-%09%09SeedFactory factory = new SeedFactory(1234);%0A%09%09%0A%09%09StoreSamplerBuilder storeSamplerBuilder = new StoreSamplerBuilder(zipcodes, factory);%0A%09%09Sampler%3CStore%3E storeSampler = storeSamplerBuilder.build();%0A%09%09%0A
 %09%09Li
@@ -956,28 +956,50 @@
 e = 
-storeSampler.sample(
+new Store(i, %22Store_%22 + i, zipcodes.get(i)
 );%0A%09

Remove StoreSampler(Builder) dependency in TestCustomerLocationPDF.