title: "Test failed to run to completion. Instrumentation run failed due to 'java.lang.NullPointerException''
body: <p>I'm writing unit tests for android, this test should verify that the url used is valid, I have a url invariant and a wrong way to perform the test, but the test does not pass. I am using JUnit.</p>
  
  <pre><code>public class FeedControleTeste extends  ActivityUnitTestCase&lt;TelaFeed&gt; {
  
      private static Context context;
      private final String FEED_ADDRESS = "http://noticias.gov.br/noticias/rss?id=AFSZW";
      private FeedControle task1, task2;
      private TelaFeed tela;
  
      public FeedControleTeste() {
          super(TelaFeed.class);
      }
  
      public void setUp() throws Exception {
          context = getInstrumentation().getTargetContext();
          tela = getActivity();
      }
  
      public void tearDown() throws Exception {
      }
  
      public void testTask() {
          final CountDownLatch signal = new CountDownLatch(1);
  
          try {
              runTestOnUiThread(new Runnable() {
                  @Override
                  public void run() {
                      task1 = new FeedControle(context, null);
                      task2 = new FeedControle(context, tela);
                      try {
                          task1.execute(FEED_ADDRESS);
                          task2.execute("url_errada");
                      } catch (Exception e) {
                          fail();
                      }
                  }
              });
  
              signal.await(30, TimeUnit.SECONDS);
          } catch (Throwable e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
  
      }
  }
  </code></pre>
  
  <p>This is my error:</p>
  
  <pre><code>Test failed to run to completion. Reason: 'Instrumentation run failed due to 'java.lang.NullPointerException''. Check device logcat for details"
  </code></pre>