@Test
public void postUpdateForValidTripButIOFails() throws Exception {

    final String name1 = "name1";
    final String name2 = "name2";
    when(mTrip1.getName()).thenReturn(name1);
    when(mTrip2.getName()).thenReturn(name2);
    when(mTrip1.getDirectory()).thenReturn(new File(name1));
    when(mStorageManager.rename(new File(name1), name2)).thenReturn(new File(name1));
    when(mTripsTable.update(mTrip2, mTrip1, new DatabaseOperationMetadata())).thenReturn(Single.just(mTrip1));
    mTripTableActionAlterations.postUpdate(mTrip1, mTrip2)
            .test()
            .assertNoValues()
            .assertNotComplete()
            .assertError(IOException.class);
    verify(mTrip2).setPrice(mPrice1);
    verify(mTrip2).setDailySubTotal(mPrice2);
    verify(mReceiptsTable).updateParentBlocking(mTrip1, mTrip2);
    verify(mDistanceTable).updateParentBlocking(mTrip1, mTrip2);
    verify(mReceiptsTable).updateParentBlocking(mTrip2, mTrip1);
    verify(mDistanceTable).updateParentBlocking(mTrip2, mTrip1);
    verify(mTripsTable).update(mTrip2, mTrip1, new DatabaseOperationMetadata());
}