@@ -0,0 +1,2841 @@
+package com.episode6.hackit.mockspresso.internal;%0A%0Aimport com.episode6.hackit.mockspresso.DefaultTestRunner;%0Aimport com.episode6.hackit.mockspresso.annotation.RealObject;%0Aimport com.episode6.hackit.mockspresso.annotation.TestQualifierAnnotation;%0Aimport com.episode6.hackit.mockspresso.api.DependencyProvider;%0Aimport com.episode6.hackit.mockspresso.reflect.DependencyKey;%0Aimport com.episode6.hackit.mockspresso.reflect.TypeToken;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.mockito.Mock;%0Aimport org.mockito.MockitoAnnotations;%0A%0Aimport static org.fest.assertions.api.Assertions.assertThat;%0Aimport static org.mockito.ArgumentMatchers.any;%0Aimport static org.mockito.ArgumentMatchers.eq;%0Aimport static org.mockito.Mockito.*;%0A%0A/**%0A * Tests %7B@link RealObjectFieldTracker%7D%0A */%0A@RunWith(DefaultTestRunner.class)%0Apublic class RealObjectFieldTrackerTest %7B%0A  private static final DependencyKey%3CTestRunnable%3E testRunnableKey = new DependencyKey%3C%3E(TypeToken.of(TestRunnable.class), null);%0A  private static final DependencyKey%3CRunnable%3E runnableKey = new DependencyKey%3C%3E(TypeToken.of(Runnable.class), null);%0A%0A  @Mock MockspressoConfigContainer mConfigContainer;%0A  @Mock RealObjectMaker mRealObjectMaker;%0A  @Mock DependencyMap mDependencyMap;%0A  @Mock DependencyProvider mDependencyProvider;%0A%0A  private RealObjectFieldTracker mRealObjectFieldTracker;%0A%0A  @Before%0A  public void setup() %7B%0A    MockitoAnnotations.initMocks(this);%0A    when(mConfigContainer.getRealObjectMaker()).thenReturn(mRealObjectMaker);%0A    when(mConfigContainer.getDependencyMap()).thenReturn(mDependencyMap);%0A    when(mConfigContainer.getDependencyProvider()).thenReturn(mDependencyProvider);%0A%0A    mRealObjectFieldTracker = new RealObjectFieldTracker(mConfigContainer);%0A  %7D%0A%0A  @Test%0A  public void testCreateAndApply() %7B%0A    TestClass1 testObject = new TestClass1();%0A    TestRunnable expectedObj = new TestRunnable();%0A    when(mRealObjectMaker.createObject(any(DependencyProvider.class), eq(testRunnableKey.typeToken)))%0A        .thenReturn(expectedObj);%0A%0A    mRealObjectFieldTracker.scanNullRealObjectFields(testObject);%0A    mRealObjectFieldTracker.createAndAssignTrackedRealObjects();%0A%0A    verify(mRealObjectMaker).createObject(any(DependencyProvider.class), eq(testRunnableKey.typeToken));%0A    verify(mDependencyMap).put(runnableKey, expectedObj);%0A    assertThat(testObject.mRealRunnable).isEqualTo(expectedObj);%0A    verifyNoMoreInteractions(mRealObjectMaker, mDependencyMap, mDependencyProvider);%0A  %7D%0A%0A  public static class TestClass1 %7B%0A    @RealObject String mPresetString = %22teststring%22;%0A    @RealObject(implementation = TestRunnable.class) Runnable mRealRunnable;%0A    @TestQualifierAnnotation TestRunnable unboundRunnable;%0A  %7D%0A%0A  public static class TestRunnable implements Runnable %7B%0A    @Override%0A    public void run() %7B%0A%0A    %7D%0A  %7D%0A%7D%0A

add an initial test for RealObjectFieldTracker