title: ContextCompat with Mockito NullPointerException
body: <p>I am using mockito to unit test my viewmodel, however im getting a <code>NullPointerException</code> with <code>ContextCompat</code>.</p>
  
  <pre><code>@RunWith(MockitoJUnitRunner.class) 
  public class ViewModelUnitTest {    
      @Mock 
      private MockContext mockContext;
      private ViewModel pViewModel; 
  
      @Before
      public void setup() {
          MockitoAnnotations.initMocks(this);
      }
  
      @Test
      public void testCProfile() throws Exception {
          Profile cProfile = GeneratorAPI.getCProfile();
          pViewModel = new ViewModel(cProfile, mockContext);
  
          assertEquals(View.GONE, pViewModel.userVisibilty.get());
         }
      }
  }
  </code></pre>
  
  <p>//ViewModel</p>
  
  <pre><code>public ViewModel(Profile profile, Context context) {
      this.profile = profile;
      this.context = context;
  
  
      this.userTitleColor = new ObservableInt(ContextCompat.getColor(context, R.color.black));
  
      this.userVisibilty = new ObservableField&lt;&gt;();
  }
  </code></pre>
  
  <p>However Im getting the following error with the <code>ContextCompat</code> :</p>
  
  <pre><code>java.lang.NullPointerException
  at android.support.v4.content.ContextCompat.getColor(ContextCompat.java:411)
  at ...ViewModel.&lt;init&gt;(ViewModel.java:102)
  at ....ViewModelUnitTest. testCProfile(ViewModelUnitTest.java:60)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at ..
  </code></pre>
  
  <p>Thanks in advance</p>