@Test
public void testOnTransUnitUpdatedInCurrentPage() throws Exception {
// Given: updated trans unit is from same document and it's on current
// page
service.init(initContext);
HasTransUnitUpdatedData updatedData =
mock(HasTransUnitUpdatedData.class, withSettings()
.defaultAnswer(RETURNS_DEEP_STUBS));
when(updatedData.getUpdateInfo().getDocumentId()).thenReturn(
initContext.getDocument().getId());
TransUnit updatedTU = data.get(0);
when(updatedData.getUpdateInfo().getTransUnit()).thenReturn(updatedTU);
EditorClientId editorClientId = new EditorClientId("sessionId", 1);
when(updatedData.getEditorClientId()).thenReturn(editorClientId);
when(updatedData.getUpdateType()).thenReturn(
TransUnitUpdated.UpdateType.WebEditorSave);
// When:
service.onTransUnitUpdated(new TransUnitUpdatedEvent(updatedData));