Example #1
0
  @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());
  }
Example #2
0
 @Test
 public void shouldCallFinishAfterSavingPerson() {
   activity.save(null);
   assertThat(activity.isFinishing(), is(true));
 }
Example #3
0
 @Test
 public void shouldSavePersonToDatabase() {
   addBobToView();
   activity.save(null);
   verify(dataAccess, times(1)).savePerson(refEq(bob));
 }