title: Testing edittext getText method
body: <p>I have a class <code>UiUtils</code> with methods such as:</p>
  
  <pre><code>public static String getEditTextValue(final EditText editText) {
      if(editText == null) return null;
      final Editable text = editText.getText();
      if(text == null) return null;
      return text.toString();
  }
  </code></pre>
  
  <p>Then I want to add unit testing to that class. I was creating a simple unit test but this is failing. I've done that:</p>
  
  <pre><code>@RunWith(MockitoJUnitRunner.class)
  public class UiUtilsTest {
      @Mock
      EditText editText;
  
      @Test
      public void getEditTextValue_ReturnsValueString() {
          final String value = "text";
          editText.setText(value);
          Assert.assertEquals(value, UiUtils.getEditTextValue(editText));
      }
  }
  </code></pre>
  
  <p>As you can see I'm creating a mocked <code>EditText</code> then I <code>setText</code> and expect to get the same value. But for some reason the <code>editText.getText()</code> method always returns <code>null</code>. What is going on here? What am I missing?</p>