getValidationRulesHandler.execute(
isA(GetValidationRulesAction.class),
any(ExecutionContext.class))).thenReturn(
validationResult);
ActivateWorkspaceResult result = handler.execute(action, null);
verify(identity).checkLoggedIn();
verify(translationWorkspace).addEditorClient(eq(HTTP_SESSION_ID),
editorClientIdCaptor.capture(), eq(person.getId()));
EditorClientId editorClientId = editorClientIdCaptor.getValue();
assertThat(editorClientId.getHttpSessionId(),
Matchers.equalTo(HTTP_SESSION_ID));
verify(translationWorkspace).publish(
enterWorkspaceEventCaptor.capture());
EnterWorkspace enterWorkspace = enterWorkspaceEventCaptor.getValue();
assertThat(enterWorkspace.getPerson(), Matchers.equalTo(person));
assertThat(enterWorkspace.getEditorClientId(),
Matchers.equalTo(editorClientId));
Identity userIdentity = result.getIdentity();
assertThat(userIdentity.getPerson(), Matchers.equalTo(person));
assertThat(userIdentity.getEditorClientId(),
Matchers.equalTo(editorClientId));
UserWorkspaceContext userWorkspaceContext =
result.getUserWorkspaceContext();
assertThat(userWorkspaceContext.getWorkspaceRestrictions()
.isHasGlossaryUpdateAccess(), Matchers.equalTo(true));
assertThat(userWorkspaceContext.getWorkspaceRestrictions()
.isProjectActive(), Matchers.equalTo(true));
assertThat(userWorkspaceContext.getWorkspaceRestrictions()
.isHasEditTranslationAccess(), Matchers.equalTo(true));
assertThat(result.getStoredUserConfiguration(),
Matchers.sameInstance(optionsResult.getConfiguration()));
}