### Question:
Gateway3DSecureActivity extends AppCompatActivity { String getExtraHtml() { Bundle extras = getIntent().getExtras(); if (extras != null) { return extras.getString(EXTRA_HTML); } return null; }   static final String EXTRA_HTML; static final String EXTRA_TITLE; static final String EXTRA_ACS_RESULT; }### Answer:
@Test public void testGetExtraHtmlReturnsNullIfMissing() { Intent testIntent = new Intent(); doReturn(testIntent).when(activity).getIntent(); String html = activity.getExtraHtml(); assertNull(html); }
@Test public void testGetExtraHtmlReturnsValueIfExists() { String expectedHtml = "<html></html>"; Intent testIntent = new Intent(); testIntent.putExtra(Gateway3DSecureActivity.EXTRA_HTML, expectedHtml); doReturn(testIntent).when(activity).getIntent(); String html = activity.getExtraHtml(); assertEquals(expectedHtml, html); }