title: Mocking @UiField when using GWTMock and Mockito
body: <p>I am using GWT2.7 where I have a view that is something like this:</p>
  
  
  
  <pre class="lang-java prettyprint-override"><code>public class InContextSearchView
      extends ViewWithUiHandlers&lt;InContextSearchUIHandlers&gt;
      implements InContextSearchPresenter.MyView
  {
  
      @UiField
      TextBox searchValueField;
  
      private final Widget m_widget;
  
      interface Binder
          extends UiBinder&lt;Widget, InContextSearchView&gt;
      {
  
      }
  
          @Inject
      public InContextSearchView( Binder binder )
      {
          m_widget = binder.createAndBindUi( this );
          searchValueField.addKeyPressHandler( new KeyPressHandler()
          {
              @Override
              public void onKeyPress( KeyPressEvent event_ )
              {
                  if( KeyCodes.KEY_ENTER == event_.getNativeEvent().getKeyCode() )
                  {
                      occSearchBtn.click();
                  }
              }
          } );
  
      }
  
      public void something(){
          //some code
      }
  }
  </code></pre>
  
  <p>For this I have written a Mockito test case as given below:</p>
  
  <pre class="lang-java prettyprint-override"><code>@RunWith( GwtMockitoTestRunner.class )
  public class TestInContextSearchView
  {
  
      /**
      @GwtMock
      InContextSearchView.Binder m_binder;
  
      @InjectMocks
      @Spy
      InContextSearchView m_inContextSearchView;
  
      @Test
      public void testSomething()
      {
          m_inContextSearchView.something();
      }
  }
  </code></pre>
  
  <p>The problem is "searchValueField" is not getting mocked and is null. So when mockito is trying to use constructor to create object for InContextSearchView it is throwing nullpointer exception. I am not supposed to touch original code.
  Also, PowerMock cannot be used if that can provide a solution.</p>
  
  <p>What am I doing wrong? How can I initialize @UiField so nullpointer exception is avoided?</p>