package uk.co.jemos.podam.test.unit;

import java.io.Serializable;

import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;

import uk.co.jemos.podam.api.PodamFactory;
import uk.co.jemos.podam.api.PodamFactoryImpl;
import uk.co.jemos.podam.api.RandomDataProviderStrategy;
import uk.co.jemos.podam.common.PodamExclude;
import uk.co.jemos.podam.test.dto.BooleanPojo;
import uk.co.jemos.podam.test.dto.SimplePojoWithExcludeAnnotationToTestSetters.TestExclude;

/**
 * Test @uk.co.jemos.podam.test.dto.BooleanPojo@ construction
 *
 * @author daivanov
 *
 */
public class BooleanUnitTest implements Serializable {
	private static final long serialVersionUID = 8040488550006045568L;

	private final static RandomDataProviderStrategy strategy =
			RandomDataProviderStrategy.getInstance();

	private final static PodamFactory podam = new PodamFactoryImpl(strategy);

	@BeforeClass
	public static void init() {
		strategy.addExcludedAnnotation(TestExclude.class);
		Assert.assertEquals("Unexpected number of exluded annotations",
				2, strategy.getExcludedAnnotations().size());
	}

	@AfterClass
	public static void deinit() {
		strategy.removeExcludedAnnotation(TestExclude.class);
		Assert.assertEquals("Unexpected number of exluded annotations",
				1, strategy.getExcludedAnnotations().size());
		Assert.assertTrue("Expected PodamExclude annotation, but found"
				+ strategy.getExcludedAnnotations().toString(),
				strategy.getExcludedAnnotations().contains(PodamExclude.class));
	}

	@Test
	public void testBooleanFieldsSetting() throws Exception {
	
		BooleanPojo pojo = podam.manufacturePojo(BooleanPojo.class);
		Assert.assertNotNull("Construction failed", pojo);

		Assert.assertEquals("Should be filled", true, pojo.isValue1());

		Assert.assertNull("Should be excluded", pojo.isValue2());

		Assert.assertNotNull("Should be filled", pojo.getValue3());
		Assert.assertEquals("Should be filled", true, pojo.getValue3());
	}

}

@@ -992,32 +992,86 @@
 Exclude.class);%0A
+%09%09strategy.addExcludedAnnotation(PodamExclude.class);%0A
 %09%09Assert.assertE
@@ -1394,195 +1394,8 @@
 ));%0A
-%09%09Assert.assertTrue(%22Expected PodamExclude annotation, but found%22%0A%09%09%09%09+ strategy.getExcludedAnnotations().toString(),%0A%09%09%09%09strategy.getExcludedAnnotations().contains(PodamExclude.class));%0A
 %09%7D%0A%0A

Make sure order of test execution doesn't break tests