void viewUpdated(boolean invalidateCache) { if (bill != null) { if (invalidateCache) bill = repository.find(bill.getUuid()); if (editView != null) { editView.setTitle(R.string.edit_bill_title); } else { String title = view.getContext().getString(R.string.bill); view.setTitle(title.concat(" ").concat(bill.getName())); } view.showBill(bill); initDate = bill.getInitDate(); if (editView != null) editView.onInitDateChanged(initDate); endDate = bill.getEndDate(); if (editView != null) editView.onEndDateChanged(endDate); } else { if (editView != null) editView.setTitle(R.string.new_bill_title); } }
@Test(expected = BillNotFoundException.class) public void load_empty_bill_throws_not_found_exception() { when(repository.find(UUID)).thenReturn(null); presenter.loadBill(UUID); }
void loadBill(String uuid) { bill = repository.find(uuid); if (bill == null) throw new BillNotFoundException(uuid); }