verify(templateDao).countByTypeAndKey(templateType, templateName);
verify(qualityGates).create(templateName);
verify(qualityGates, times(8)).createCondition(anyLong(), anyString(), anyString(), anyString(), anyString(), anyInt());
ArgumentCaptor<LoadedTemplateDto> templateArg = ArgumentCaptor.forClass(LoadedTemplateDto.class);
verify(templateDao).insert(templateArg.capture());
LoadedTemplateDto template = templateArg.getValue();
assertThat(template.getType()).isEqualTo(templateType);
assertThat(template.getKey()).isEqualTo(templateName);
task.stop();
}