ProvinceInfoParserTask extends AsyncTask<Void, Void, List<ProvinceModel>> { @Override protected void onPostExecute(List<ProvinceModel> result) { super.onPostExecute(result); if (null != mHandler) mHandler.sendMessage(mHandler.obtainMessage(MSG_PARSE_RESULT_CALLBACK, result)); } ProvinceInfoParserTask(Context context, Handler handler);  static final int MSG_PARSE_RESULT_CALLBACK; }
@Test public void testOnPostExecute() { provinceInfoParserTask.onPostExecute(provinces); verify(mockHandler).sendMessage(mockMessage); }
@Test public void testOnPostExecuteWithNullHandler() { Whitebox.setInternalState(provinceInfoParserTask, "mHandler", null); provinceInfoParserTask.onPostExecute(provinces); verify(mockHandler, never()).sendMessage(any(Message.class)); }