title: Unit test Android, getString from resource
body: <p>I am trying to do an unit test for an android app and I need to get a string from res.string resources. The class that I want to test is a POJO class. I am doing the app in two languages, due to this, I need to get a string from resource. The problem is that I cannot get the context or the activity, is possible? I know that with Instrumentation test I can do it, but I need to test some functions (white box test) before to do the instrumentation test (black box test). 
  This is the function that I have to test:</p>
  
  <pre><code>public void setDiaByText(String textView) {
      getll_diaSeleccionado().clear();
      if (textView.contains(context.getResources().getString(R.string.sInicialLunes))) {
          getll_diaSeleccionado().add(0);
          getIsSelectedArray()[0] = true;
          getI_idiaSeleccionado()[0] =1;
  
      } else
      {
          getIsSelectedArray()[0] = false;
          getI_idiaSeleccionado()[0] =0;
      }
  }
  </code></pre>
  
  <p>And this is the test:</p>
  
  <pre><code>@Test
  public void setDiaByTextView() {
      String texto = "L,M,X,J,V,S,D";
  
      alertaPOJO.setDiaByText(texto);
  
      assertEquals(alertaPOJO.getIsSelectedArray()[0], true);
      assertEquals(alertaPOJO.getI_idiaSeleccionado()[0], 1);
  }
  </code></pre>
  
  <p>It crash when try to do <code>context.getResources().getString(R.string.sInicialLunes))</code></p>
  
  <p>If I put 'Mon' instead of <code>context.getResources().getString(R.string.sInicialLunes))</code> or 'L' it work perfectly so, is possible to get the context or the activity in order to access to resource folder?</p>
  
  <p>I am testing with Mockito and the setUp function is:</p>
  
  <pre><code>@Before
  public void setUp() throws Exception {
  
      MockitoAnnotations.initMocks(this);
      mContext = Mockito.mock(Alerta.class);
      Mockito.when(mContext.getApplicationContext()).thenReturn(mContext);
  
      alertaPOJO = new AlertaPOJO();
  }
  </code></pre>
  
  <p>Thanks</p>