TestFixture.makeTransUnit(TRANS_UNIT_ID.getId(),
ContentState.NeedReview, "old content");
when(navigationService.getByIdOrNull(TRANS_UNIT_ID)).thenReturn(old);
// When: save as fuzzy
TransUnitSaveEvent saveEvent =
event("new content", ContentState.NeedReview, TRANS_UNIT_ID,
VER_NUM, "old content");
service.onTransUnitSave(saveEvent);
verify(dispatcher).execute(actionCaptor.capture(),
resultCaptor.capture());
// on rpc failure:
// Then: will reset value back
AsyncCallback<UpdateTransUnitResult> callback = resultCaptor.getValue();
when(messages.notifyUpdateFailed("id " + TRANS_UNIT_ID, errorMessage))
.thenReturn("update failed");
callback.onFailure(new RuntimeException(errorMessage));
verify(targetContentsPresenter).setEditingState(
saveEvent.getTransUnitId(),
TargetContentsDisplay.EditingState.UNSAVED);
ArgumentCaptor<NotificationEvent> notificationEventCaptor =
ArgumentCaptor.forClass(NotificationEvent.class);
verify(targetContentsPresenter).setEditingState(TRANS_UNIT_ID,
TargetContentsDisplay.EditingState.UNSAVED);