new CopyTransServiceImpl(
localeServiceImpl, projectDAO, documentDAO,
copyTransWorkFactory, textFlowTargetDAO,
translationStateCacheImpl, textFlowDAO);
HCopyTransOptions projOptions = new HCopyTransOptions(IGNORE, IGNORE, IGNORE);
String projSlug = "projslug";
long projId = 123L;
HProject proj = createProject(projSlug, projId, projOptions);
when(projectDAO.findById(projId, false)).thenReturn(proj);
String iterSlug = "iterslug";
boolean requireReview = true;
HProjectIteration iter = createIter(iterSlug, proj, requireReview);
List<HTextFlow> textFlows = Arrays.asList(new HTextFlow());
HDocument doc = createDoc(iter, textFlows);
when(documentDAO.findById(doc.getId())).thenReturn(doc);
HLocale de = new HLocale(LocaleId.DE);
List<HLocale> localeList = Arrays.asList(de);
when(localeServiceImpl.getSupportedLanguageByProjectIteration(projSlug, iterSlug)).thenReturn(localeList);
when(copyTransWorkFactory
.createCopyTransWork(any(HLocale.class),
any(HCopyTransOptions.class), any(HDocument.class),
anyBoolean(), anyListOf(HTextFlow.class)))
.thenReturn(
copyTransWork);
HCopyTransOptions optionsIn, optionsOut;
if (useProjectOpts) {
optionsIn = null;
optionsOut = projOptions;
} else {
optionsIn = new HCopyTransOptions(DOWNGRADE_TO_FUZZY, DOWNGRADE_TO_FUZZY, DOWNGRADE_TO_FUZZY);
optionsOut = optionsIn;
}
ctService.copyTransForDocument(doc, optionsIn, null);