title: How to test a method returns boolean in Mockito
body: <p>I am learning how to unit-testing in android studio. As shown below, I have a method called "isValidUrl" and in the testing section below, I coded the testing
  of that method using Mockito, but the test always fails.</p>
  
  <p>Can you please help and guild me how to test this method?</p>
  
  <p><strong>code</strong></p>
  
  <pre><code>public boolean isValidUrl(String url) {
      return (url != null &amp;&amp; !url.equals("")) ? true : false;
  }
  </code></pre>
  
  <p><strong>testing</strong>:</p>
  
  <pre><code>public class ValidationTest {
  @Mock
  private Context mCtx = null;
  
  @Before
  public void setUp() throws Exception {
      mCtx = Mockito.mock(Context.class);
      Assert.assertNotNull("Context is not null", mCtx);
  }
  
  @Test
  public void isValidUrl() throws Exception {
      Validation validation = new Validation(mCtx);
      String url = null;
      Mockito.when(validation.isValidUrl(url)).thenReturn(false);
  }
  </code></pre>
  
  <p>}</p>