Created
December 10, 2013 09:05
-
-
Save timurvafin/7887716 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RunWith(RobolectricGradleTestRunner.class) | |
public class MainActivityTest { | |
@Inject CookieManager cookieManager; | |
@Before | |
public void setUp() { | |
injectMocks(this); | |
} | |
// tests if the same instance is injected in test and in Activity | |
@Test | |
public void testInjection() throws Exception { | |
assertEquals(cookieManager, | |
buildActivity(MainActivity.class).create().get().cookieManager); | |
} | |
// tests if Activity is finishing if there's no cookie for vk.com | |
@Test | |
public void testLoggedOut() throws Exception { | |
when(cookieManager.getCookie("vk.com")).thenReturn(null); | |
assertTrue(buildActivity(MainActivity.class).create().get().isFinishing()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment