title: Mock BuildConfig in Android
body: <p><code>PowerMock</code> doesn't seem to alter the <code>BuildConfig</code> field values when setting it during tests.</p>
  
  <p>Currently I have these in my <code>BuildConfig</code></p>
  
  <pre><code>public static final String SAMPLE_FIELD = "Sample Value";
  </code></pre>
  
  <p>I would want to change it to some other value (eg., "Another Value")</p>
  
  <p>I tried <code>Whitebox</code> but it doesnt work.</p>
  
  <pre><code>Whitebox.setInternalState(BuildConfig.class , "SAMPLE_FIELD" , "Another Value");
  
  Field f = Whitebox.getField(BuildConfig.class, "SAMPLE_FIELD");
  f.setAccessible(true);
  f.set(String.class , "Another Value");
  </code></pre>
  
  <p>Is this really gonna work, or this is an alternative way to change the those values?</p>