package com.translationdata.p000;

import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.translationdata.JUnitTests.FastTest;

import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.MatcherAssert.assertThat;


/** Strategy: Spring XML configuration. */
@Category(FastTest.class)
public class P001_UnitTest {
	public P001_MultiplesOf3And5 getMultiplesOf3And5() {
		ApplicationContext appContext = new ClassPathXmlApplicationContext("com/translationdata/resources/P001_applicationContext.xml");
		return appContext.getBean("multiplesOf3And5", P001_MultiplesOf3And5.class);
	}

	@Test(timeout=1000)
	public void SumOfMultiplesOf3And5Below1000() {
		final int sumOfMultiples = getMultiplesOf3And5().multiplesOf3And5(1_000);
		System.out.printf("multiplesOf3And5(1000) = %s%n", sumOfMultiples);
		assertThat( "Incorrect sum of multiples of 3 or 5 below 1,000", sumOfMultiples, is(233168) );
	}
	
	@Test(timeout=1000)
	public void SumOfMultiplesOf3And5Below10_000() {
		final int sumOfMultiples = getMultiplesOf3And5().multiplesOf3And5(10_000);
		System.out.printf("P001: multiplesOf3And5(10_000) = %s%n", sumOfMultiples);
		assertThat( "Incorrect sum of multiples of 3 or 5 below 10,000", sumOfMultiples, is(23331668) );
	}
}

@@ -105,138 +105,8 @@
 ory;
-%0Aimport org.springframework.context.ApplicationContext;%0Aimport org.springframework.context.support.ClassPathXmlApplicationContext;
 %0A%0Aim
@@ -353,273 +353,110 @@
  %7B%0A%09
-public P001_MultiplesOf3And5 getMultiplesOf3And5() %7B%0A%09%09ApplicationContext appContext = new ClassPathXmlApplicationContext(%22com/translationdata/resources/P001_applicationContext.xml%22);%0A%09%09return appContext.getBean(%22multiplesOf3And5%22, P001_MultiplesOf3And5.class
+String resourcePath;%0A%09String fileName;%0A%09final P001_Factory p001_Factory = P001_Factory.getFactory(
 );%0A%09
-%7D%0A
 %0A%09@T
@@ -542,32 +542,45 @@
 umOfMultiples = 
+p001_Factory.
 getMultiplesOf3A
@@ -631,16 +631,22 @@
 printf(%22
+P001: 
 multiple
@@ -887,16 +887,29 @@
 iples = 
+p001_Factory.
 getMulti

Call factory to start application