// Path: src/main/java/br/com/six2six/fixturefactory/loader/FixtureFactoryLoader.java
// public class FixtureFactoryLoader {
// 
// 	public static void loadTemplates(String basePackage) {
//         for (Class<?> clazz : getClassesForPackage(basePackage)) {
//             if (!clazz.isInterface() && TemplateLoader.class.isAssignableFrom(clazz)) {
//                 try {
//                 	((TemplateLoader) clazz.newInstance()).load();
//                 } catch (Exception e) {
//                     throw new RuntimeException(String.format("template %s not loaded", clazz.getName()), e);
//                 }
//             }
//         } 
// 	}
// }
// 
// Path: src/main/java/br/com/six2six/fixturefactory/util/DateTimeUtils.java
// public class DateTimeUtils {
// 
// 	public static Calendar toCalendar(String source, DateFormat format) {
// 		Calendar date = Calendar.getInstance();
// 		try {
// 			date.setTimeInMillis(format.parse(source).getTime());
// 		} catch (ParseException e) {
// 			throw new IllegalArgumentException(e);
// 		}
// 		return date;
// 	}
// 	
// 	public static java.time.ZonedDateTime toZonedDateTime(Calendar value) {
// 		return value.toInstant().atZone(value.getTimeZone().toZoneId());
// 	}
// 	
// }


import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.List;
import org.junit.BeforeClass;
import org.junit.Test;
import br.com.six2six.fixturefactory.loader.FixtureFactoryLoader;
import br.com.six2six.fixturefactory.model.Invoice;
import br.com.six2six.fixturefactory.util.DateTimeUtils;
package br.com.six2six.fixturefactory;





public class FixtureInvoiceTest {

	@BeforeClass
	public static void setUp() {
		FixtureFactoryLoader.loadTemplates("br.com.six2six.template");
	}

	@Test
	public void fixtureInvoice() {
		Invoice invoice = Fixture.from(Invoice.class).gimme("valid");
		assertNotNull("Invoice should not be null", invoice);
		assertEquals("Invoice ammout should have precision of 2", 2, invoice.getAmmount().precision());
	}
	
	@Test
	public void fixturePreviousInvoices() {
		List<Invoice> invoices = Fixture.from(Invoice.class).gimme(3, "previousInvoices");
		assertNotNull("Invoice list should not be null", invoices);
		assertTrue("Invoice list should not be empty", !invoices.isEmpty());
		
// Path: src/main/java/br/com/six2six/fixturefactory/loader/FixtureFactoryLoader.java
// public class FixtureFactoryLoader {
// 
// 	public static void loadTemplates(String basePackage) {
//         for (Class<?> clazz : getClassesForPackage(basePackage)) {
//             if (!clazz.isInterface() && TemplateLoader.class.isAssignableFrom(clazz)) {
//                 try {
//                 	((TemplateLoader) clazz.newInstance()).load();
//                 } catch (Exception e) {
//                     throw new RuntimeException(String.format("template %s not loaded", clazz.getName()), e);
//                 }
//             }
//         } 
// 	}
// }
// 
// Path: src/main/java/br/com/six2six/fixturefactory/util/DateTimeUtils.java
// public class DateTimeUtils {
// 
// 	public static Calendar toCalendar(String source, DateFormat format) {
// 		Calendar date = Calendar.getInstance();
// 		try {
// 			date.setTimeInMillis(format.parse(source).getTime());
// 		} catch (ParseException e) {
// 			throw new IllegalArgumentException(e);
// 		}
// 		return date;
// 	}
// 	
// 	public static java.time.ZonedDateTime toZonedDateTime(Calendar value) {
// 		return value.toInstant().atZone(value.getTimeZone().toZoneId());
// 	}
// 	
// }


// Path: src/test/java/br/com/six2six/fixturefactory/FixtureInvoiceTest.java
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.List;
import org.junit.BeforeClass;
import org.junit.Test;
import br.com.six2six.fixturefactory.loader.FixtureFactoryLoader;
import br.com.six2six.fixturefactory.model.Invoice;
import br.com.six2six.fixturefactory.util.DateTimeUtils;

package br.com.six2six.fixturefactory;





public class FixtureInvoiceTest {

	@BeforeClass
	public static void setUp() {
		FixtureFactoryLoader.loadTemplates("br.com.six2six.template");
	}

	@Test
	public void fixtureInvoice() {
		Invoice invoice = Fixture.from(Invoice.class).gimme("valid");
		assertNotNull("Invoice should not be null", invoice);
		assertEquals("Invoice ammout should have precision of 2", 2, invoice.getAmmount().precision());
	}
	
	@Test
	public void fixturePreviousInvoices() {
		List<Invoice> invoices = Fixture.from(Invoice.class).gimme(3, "previousInvoices");
		assertNotNull("Invoice list should not be null", invoices);
		assertTrue("Invoice list should not be empty", !invoices.isEmpty());
		
		Calendar calendar = DateTimeUtils.toCalendar("2011-04-01", new SimpleDateFormat("yyyy-MM-dd"));