### Question:
SupportMenuInflater extends MenuInflater { @Override public void inflate(@LayoutRes int menuRes, Menu menu) { if (!(menu instanceof SupportMenu)) { super.inflate(menuRes, menu); return; } XmlResourceParser parser = null; try { parser = mContext.getResources().getLayout(menuRes); AttributeSet attrs = Xml.asAttributeSet(parser); parseMenu(parser, attrs, menu); } catch (XmlPullParserException e) { throw new InflateException("Error inflating menu XML", e); } catch (IOException e) { throw new InflateException("Error inflating menu XML", e); } finally { if (parser != null) parser.close(); } } SupportMenuInflater(Context context); @Override void inflate(@LayoutRes int menuRes, Menu menu);  }### Answer:
@Test public void testInflateFromXml() { mMenuInflater.inflate(R.menu.shortcut, mMenu); SupportMenuItem mMenuItem; mMenuItem = (SupportMenuItem) mMenu.findItem(R.id.no_modifiers); assertEquals('a', mMenuItem.getAlphabeticShortcut()); assertEquals(KeyEvent.META_CTRL_ON, mMenuItem.getAlphabeticModifiers()); assertEquals('1', mMenuItem.getNumericShortcut()); assertEquals(KeyEvent.META_CTRL_ON, mMenuItem.getNumericModifiers()); mMenuItem = (SupportMenuItem) mMenu.findItem(R.id.default_modifiers); assertEquals('b', mMenuItem.getAlphabeticShortcut()); assertEquals(KeyEvent.META_CTRL_ON, mMenuItem.getAlphabeticModifiers()); assertEquals('2', mMenuItem.getNumericShortcut()); assertEquals(KeyEvent.META_CTRL_ON, mMenuItem.getNumericModifiers()); mMenuItem = (SupportMenuItem) mMenu.findItem(R.id.single_modifier); assertEquals('c', mMenuItem.getAlphabeticShortcut()); assertEquals(KeyEvent.META_SHIFT_ON, mMenuItem.getAlphabeticModifiers()); assertEquals('3', mMenuItem.getNumericShortcut()); assertEquals(KeyEvent.META_SHIFT_ON, mMenuItem.getNumericModifiers()); mMenuItem = (SupportMenuItem) mMenu.findItem(R.id.multiple_modifiers); assertEquals('d', mMenuItem.getAlphabeticShortcut()); assertEquals(KeyEvent.META_CTRL_ON | KeyEvent.META_SHIFT_ON, mMenuItem.getAlphabeticModifiers()); assertEquals('4', mMenuItem.getNumericShortcut()); assertEquals(KeyEvent.META_CTRL_ON | KeyEvent.META_SHIFT_ON, mMenuItem.getNumericModifiers()); }