package com.xtremelabs.robolectric.shadows;

import android.app.Application;
import android.view.MenuInflater;
import com.xtremelabs.robolectric.view.TestMenu;
import com.xtremelabs.robolectric.view.TestMenuItem;
import com.xtremelabs.robolectric.R;
import com.xtremelabs.robolectric.Robolectric;
import com.xtremelabs.robolectric.WithTestDefaultsRunner;
import com.xtremelabs.robolectric.res.ResourceLoader;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

import java.io.File;
import static com.xtremelabs.robolectric.Robolectric.shadowOf;

import static org.junit.Assert.assertEquals;

@RunWith(WithTestDefaultsRunner.class)
public class MenuInflaterTest {
    private ShadowMenuInflater MenuInflater;

    @Before
    public void setUp() throws Exception {
        Robolectric.bindDefaultShadowClasses();
        Robolectric.application = ShadowApplication.bind(new Application(), new ResourceLoader(R.class, new File("test/res")));
        MenuInflater = shadowOf(new MenuInflater(Robolectric.application));
    }

	@Test
	public void canRetrieveMenuList()
	{
        TestMenu menu = new TestMenu();
		System.out.println(MenuInflater);
		MenuInflater.inflate(R.menu.test, menu);
		
        TestMenuItem testMenuItem = (TestMenuItem) menu.getItem(0);
        assertEquals("Test menu item 1", testMenuItem.getTitle().toString());
        testMenuItem.click();

		testMenuItem = (TestMenuItem) menu.getItem(1);
        assertEquals("Test menu item 2", testMenuItem.getTitle().toString());
        testMenuItem.click();
	}

}

@@ -508,71 +508,8 @@
 ile;
-%0Aimport static com.xtremelabs.robolectric.Robolectric.shadowOf;
 %0A%0Aim
@@ -635,22 +635,16 @@
 private 
-Shadow
 MenuInfl
@@ -921,17 +921,8 @@
 r = 
-shadowOf(
 new 
@@ -958,17 +958,16 @@
 ication)
-)
 ;%0A    %7D%0A
@@ -1056,44 +1056,8 @@
 ();%0A
-%09%09System.out.println(MenuInflater);%0A
 %09%09Me

Stop explicitly calling shadowOf