@@ -0,0 +1,2508 @@
+package com.pedrovalencia.trackmystock.activities;%0A%0Aimport android.app.Activity;%0Aimport android.view.MenuInflater;%0A%0Aimport com.pedrovalencia.trackmystock.R;%0A%0Aimport org.junit.After;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.robolectric.Robolectric;%0Aimport org.robolectric.RobolectricTestRunner;%0Aimport org.robolectric.annotation.Config;%0Aimport org.robolectric.tester.android.view.TestMenu;%0Aimport org.robolectric.tester.android.view.TestMenuItem;%0Aimport org.robolectric.util.ActivityController;%0A%0Aimport static org.junit.Assert.assertTrue;%0A%0A/**%0A * Created by pedrovalencia on 18/10/14.%0A */%0A@Config(emulateSdk = 18)%0A@RunWith(RobolectricTestRunner.class)%0Apublic class AddCompanyActivityTest %7B%0A%0A    private ActivityController activityController;%0A%0A    @Before%0A    public void setUp() throws Exception %7B%0A        activityController = Robolectric.buildActivity(AddCompanyActivity.class).create();%0A    %7D%0A%0A    @After%0A    public void tearDown() throws Exception %7B%0A        activityController.destroy();%0A    %7D%0A%0A    @Test%0A    public void testActivityNotNull() throws Exception %7B%0A        Activity activity = (Activity)activityController.get();%0A        assertTrue(%22Activity is null%22, activity != null);%0A    %7D%0A%0A    @Test%0A    public void testOnCreateOptionsMenu() throws Exception %7B%0A%0A        Activity activity = (Activity)activityController.get();%0A%0A        //Simulate a Menu object%0A        TestMenu testMenu = new TestMenu(Robolectric.application);%0A        new MenuInflater(Robolectric.application).inflate(R.menu.add_company, testMenu);%0A%0A        activity.onCreateOptionsMenu(testMenu);%0A%0A        //Test the first item is Settings%0A        TestMenuItem menuItem = (TestMenuItem)testMenu.getItem(0);%0A        assertTrue(%22First menu is not Settings: %22 + menuItem.getItemId(),%0A                menuItem.getItemId() == R.id.action_settings);%0A%0A    %7D%0A%0A    @Test%0A    public void testOnOptionsItemSelected() throws Exception %7B%0A%0A        Activity activity = (Activity)activityController.get();%0A        //Simulate a Menu object%0A        TestMenu testMenu = new TestMenu(Robolectric.application);%0A        new MenuInflater(Robolectric.application).inflate(R.menu.add_company, testMenu);%0A%0A        TestMenuItem menuItem = (TestMenuItem)testMenu.getItem(0);%0A%0A        //TODO test we go to SettingsActivity%0A        activity.onOptionsItemSelected(menuItem);%0A        menuItem.click();%0A%0A        menuItem.setItemId(0);%0A        activity.onOptionsItemSelected(menuItem);%0A        menuItem.click();%0A    %7D%0A%7D%0A

Add AddCompanyActivityTest (100% test coverage OH YEAH!!)