package me.nallar.mixin.internal;

import lombok.val;
import me.nallar.mixin.internal.mixinsource.MixinSource;
import org.junit.Assert;
import org.junit.Test;

public class MixinApplicatorTest {
	@Test
	public void testGetMixinTransformer() throws Exception {
		val applicator = new MixinApplicator();
		applicator.addSource(MixinSource.class);
		val transformer = applicator.getMixinTransformer();

		Assert.assertTrue("Must have at least one mixin transformer registered", transformer.getClassTransformers().size() != 0);
	}

	@Test
	public void testGetMixinTransformerWithPackageSource() throws Exception {
		val applicator = new MixinApplicator();
		applicator.addSource("me.nallar.mixin.internal.mixinsource");
		val transformer = applicator.getMixinTransformer();

		Assert.assertTrue("Must have at least one mixin transformer registered", transformer.getClassTransformers().size() != 0);
	}

	@Test(expected = IllegalStateException.class)
	public void testGetMixinTransformerWithPackageSourceWrongOrder() throws Exception {
		val applicator = new MixinApplicator();
		applicator.getMixinTransformer();
		applicator.addSource("me.nallar.mixin.internal.mixinsource");
	}
}

@@ -902,48 +902,8 @@
 Test
-(expected = IllegalStateException.class)
 %0A%09pu
@@ -1126,13 +1126,192 @@
 urce%22);%0A
+%09%09val transformer = applicator.getMixinTransformer();%0A%0A%09%09Assert.assertTrue(%22Must have at least one mixin transformer registered%22, transformer.getClassTransformers().size() != 0);%0A
 %09%7D%0A%7D%0A

Test now checks that transformer returned includes source if called before source added then after