}
@Test
public void willDetectSaveDoneByAnotherUserAndCurrentUserHasUnsavedChange() {
// Given: coming client id is NOT current user
EditorClientId currentUser = new EditorClientId("session1", 1);
when(translatorService.getCurrentEditorClientId()).thenReturn(
currentUser);
TransUnit updatedTransUnit = TestFixture.makeTransUnit(1);
presenter.setStateForTesting(updatedTransUnit.getId());
when(messages.concurrentEdit()).thenReturn("concurrent edit detected");
when(messages.concurrentEditTitle()).thenReturn(
"please resolve conflict");
// current user does not have unsaved change
when(targetContentsPresenter.currentEditorContentHasChanged())
.thenReturn(true);
// When: update type is save
presenter.refreshRow(updatedTransUnit,
new EditorClientId("session2", 2),
TransUnitUpdated.UpdateType.WebEditorSave);
// Then:
ArgumentCaptor<NotificationEvent> eventCaptor =
ArgumentCaptor.forClass(NotificationEvent.class);