### Question:
ExtraUtil { public static <T> T getExtra(Bundle extras, String name, boolean nullable) { T value = null; if (extras != null && extras.containsKey(name)) { value = (T)extras.get(name); } if (!nullable && value == null) { throw new TransfuseInjectionException("Unable to access Extra " + name); } return value; } private  ExtraUtil(); static T getExtra(Bundle extras, String name, boolean nullable); static final String GET_EXTRA; }### Answer:
@Test public void testNullExtras() { ExtraUtil.getExtra(null, TEST_NAME, true); }
@Test(expected = TransfuseInjectionException.class) public void testUnexpectedNullExtras() { ExtraUtil.getExtra(null, TEST_NAME, false); }
@Test public void getExtra() { Bundle mockBundle = new Bundle(); mockBundle.putString(TEST_NAME, TEST_EXTRA_TARGET); Object extraOutput = ExtraUtil.getExtra(mockBundle, TEST_NAME, false); assertEquals(TEST_EXTRA_TARGET, extraOutput); }
@Test(expected = TransfuseInjectionException.class) public void getExtraThatIsExpectedToExist() { Bundle mockBundle = new Bundle(); ExtraUtil.getExtra(mockBundle, TEST_NAME, false); }
@Test public void getExtraThatIsOptional() { Bundle mockBundle = new Bundle(); assertNull(ExtraUtil.getExtra(mockBundle, TEST_NAME, true)); }