package com.basgeekball.awesomevalidation;

import com.basgeekball.awesomevalidation.validators.BasicValidator;
import com.basgeekball.awesomevalidation.validators.ColorationValidator;
import com.basgeekball.awesomevalidation.validators.UnderlabelValidator;

import junit.framework.TestCase;

import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import org.powermock.reflect.Whitebox;

@RunWith(PowerMockRunner.class)
@PrepareForTest(AwesomeValidation.class)
public class AwesomeValidationTest extends TestCase {

    public void testAwesomeValidationConstructBasicStyle() {
        AwesomeValidation awesomeValidation = new AwesomeValidation(ValidationStyle.BASIC);
        assertTrue(Whitebox.getInternalState(awesomeValidation, "mValidator") instanceof BasicValidator);
    }

    public void testAwesomeValidationConstructColorationStyle() {
        AwesomeValidation awesomeValidation = new AwesomeValidation(ValidationStyle.COLORATION);
        assertTrue(Whitebox.getInternalState(awesomeValidation, "mValidator") instanceof ColorationValidator);
    }

    public void testAwesomeValidationConstructUnderlabelValidatorStyle() {
        AwesomeValidation awesomeValidation = new AwesomeValidation(ValidationStyle.UNDERLABEL);
        assertTrue(Whitebox.getInternalState(awesomeValidation, "mValidator") instanceof UnderlabelValidator);
    }

}

@@ -37,16 +37,49 @@
 ation;%0A%0A
+import android.content.Context;%0A%0A
 import c
@@ -130,32 +130,32 @@
 BasicValidator;%0A
-
 import com.basge
@@ -352,16 +352,131 @@
 unWith;%0A
+import org.powermock.api.mockito.PowerMockito;%0Aimport org.powermock.api.support.membermodification.MemberModifier;%0A
 import o
@@ -626,16 +626,180 @@
 tebox;%0A%0A
+import static org.mockito.Mockito.doThrow;%0Aimport static org.mockito.Mockito.mock;%0Aimport static org.mockito.Mockito.spy;%0Aimport static org.mockito.Mockito.times;%0A%0A
 @RunWith
@@ -1637,16 +1637,16 @@
 LABEL);%0A
-
         
@@ -1755,10 +1755,2214 @@
 %0A    %7D%0A%0A
+    public void testSetContextForUnderlabelStyle() throws Exception %7B%0A        UnderlabelValidator spiedUnderlabelValidator = spy(UnderlabelValidator.class);%0A        AwesomeValidation spiedAwesomeValidation = spy(new AwesomeValidation(ValidationStyle.UNDERLABEL));%0A        MemberModifier.field(AwesomeValidation.class, %22mValidator%22).set(spiedAwesomeValidation, spiedUnderlabelValidator);%0A        Context mockedContext = mock(Context.class);%0A        spiedAwesomeValidation.setContext(mockedContext);%0A        PowerMockito.verifyPrivate(spiedUnderlabelValidator, times(1)).invoke(%22setContext%22, mockedContext);%0A    %7D%0A%0A    public void testSetContextForNonUnderlabelStyle() throws Exception %7B%0A        BasicValidator spiedBasicValidator = spy(BasicValidator.class);%0A        AwesomeValidation spiedAwesomeValidation = spy(new AwesomeValidation(ValidationStyle.BASIC));%0A        MemberModifier.field(AwesomeValidation.class, %22mValidator%22).set(spiedAwesomeValidation, spiedBasicValidator);%0A        Context mockedContext = mock(Context.class);%0A        doThrow(UnsupportedOperationException.class).when(spiedAwesomeValidation).setContext(mockedContext);%0A    %7D%0A%0A    public void testSetColorForColorationStyle() throws Exception %7B%0A        ColorationValidator spiedColorationValidator = spy(ColorationValidator.class);%0A        AwesomeValidation spiedAwesomeValidation = spy(new AwesomeValidation(ValidationStyle.COLORATION));%0A        MemberModifier.field(AwesomeValidation.class, %22mValidator%22).set(spiedAwesomeValidation, spiedColorationValidator);%0A        int color = 256;%0A        spiedAwesomeValidation.setColor(color);%0A        PowerMockito.verifyPrivate(spiedColorationValidator, times(1)).invoke(%22setColor%22, color);%0A    %7D%0A%0A    public void testSetColorForNonColorationStyle() throws Exception %7B%0A        BasicValidator spiedBasicValidator = spy(BasicValidator.class);%0A        AwesomeValidation spiedAwesomeValidation = spy(new AwesomeValidation(ValidationStyle.BASIC));%0A        MemberModifier.field(AwesomeValidation.class, %22mValidator%22).set(spiedAwesomeValidation, spiedBasicValidator);%0A        int color = 256;%0A        doThrow(UnsupportedOperationException.class).when(spiedAwesomeValidation).setColor(color);%0A    %7D%0A%0A
 %7D%0A

Add tests for AwesomeValidation's setContext and setColor