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

import static org.junit.Assert.assertNotNull;
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.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.store.StoreSamplerBuilder;

public class TestStoreSamplerBuilder
{

	@Test
	public void testBuild() 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);
		
		SeedFactory factory = new SeedFactory(1234);
		
		StoreSamplerBuilder builder = new StoreSamplerBuilder(zipcodes, factory);
		Sampler<Store> sampler = builder.build();
		
		Store store = sampler.sample();
		assertNotNull(store);
		assertTrue(store.getId() >= 0);
		assertNotNull(store.getName());
		assertNotNull(store.getLocation());
		
	}

}

@@ -144,24 +144,49 @@
 ssertTrue;%0A%0A
+import java.util.Arrays;%0A
 import java.
@@ -266,25 +266,31 @@
 nerator.
-Constants
+datamodels.Pair
 ;%0Aimport
@@ -436,80 +436,8 @@
 re;%0A
-import com.github.rnowling.bps.datagenerator.datareaders.ZipcodeReader;%0A
 impo
@@ -576,91 +576,8 @@
 ler;
-%0Aimport com.github.rnowling.bps.datagenerator.generators.store.StoreSamplerBuilder;
 %0A%0Apu
@@ -668,16 +668,21 @@
 on%0A%09%7B%0A%09%09
+List%3C
 ZipcodeR
@@ -686,214 +686,211 @@
 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%09%09new ZipcodeRecord(%2222222%22, Pair.create(2.0, 2.0), 45000.0, 200),
 %0A%09%09
-%0A
 %09%09
-List%3C
+new 
 Zipc
@@ -902,37 +902,60 @@
 cord
-%3E zipcodes = reade
+(%2233333%22, Pai
 r.
+c
 rea
-dData(
+te(3.0, 3.0), 60000.0, 300)%0A%09%09%09%09%7D
 );%0A%09

Remove file reader dependency from TestStoreSamplerBuilder