@Before public void setUp() { initMocks(this); given(dataAccessFactory.people(any(Context.class))).willReturn(dataAccess); ObjectGraph.create(new AndroidModule(Robolectric.application), new TestModule()).inject(this); activity.onCreate(new Bundle()); }
@Test public void shouldCallFinishAfterSavingPerson() { activity.save(null); assertThat(activity.isFinishing(), is(true)); }
@Test public void shouldSavePersonToDatabase() { addBobToView(); activity.save(null); verify(dataAccess, times(1)).savePerson(refEq(bob)); }