@Test public void checkSnpAssociationInteractionFormErrorsWithNoErrors() throws Exception { when(errorCreationService.checkSnpValueIsPresent(Matchers.anyString())).thenReturn(SNP_NO_ERROR); when(errorCreationService.checkStrongestAlleleValueIsPresent(Matchers.anyString())).thenReturn( RISK_ALLELE_NO_ERROR); when(errorCreationService.checkOrIsPresent(Matchers.anyFloat())).thenReturn(OR_NO_ERROR); assertThat(associationOperationsService.checkSnpAssociationInteractionFormErrors( SNP_ASSOCIATION_INTERACTION_FORM, "or")).isInstanceOf(List.class) .hasOnlyElementsOfType( AssociationValidationView.class) .hasSize(0); }
public List<AssociationValidationView> checkSnpAssociationInteractionFormErrors(SnpAssociationInteractionForm form, String measurementType) { Collection<ValidationError> errors = new ArrayList<>(); for (SnpFormColumn column : form.getSnpFormColumns()) { errors.add(errorCreationService.checkSnpValueIsPresent(column.getSnp())); errors.add(errorCreationService.checkStrongestAlleleValueIsPresent(column.getStrongestRiskAllele())); } if (measurementType.equals("or")) { errors.add(errorCreationService.checkOrIsPresent(form.getOrPerCopyNum())); } if (measurementType.equals("beta")) { errors.add(errorCreationService.checkBetaIsPresentAndIsNotNegative(form.getBetaNum())); } Collection<ValidationError> updatedError = ErrorProcessingService.checkForValidErrors(errors); return processAssociationValidationErrors(updatedError); }
AssociationOperationsService { public List<AssociationValidationView> checkSnpAssociationInteractionFormErrors(SnpAssociationInteractionForm form, String measurementType) { Collection<ValidationError> errors = new ArrayList<>(); for (SnpFormColumn column : form.getSnpFormColumns()) { errors.add(errorCreationService.checkSnpValueIsPresent(column.getSnp())); errors.add(errorCreationService.checkStrongestAlleleValueIsPresent(column.getStrongestRiskAllele())); } if (measurementType.equals("or")) { errors.add(errorCreationService.checkOrIsPresent(form.getOrPerCopyNum())); } if (measurementType.equals("beta")) { errors.add(errorCreationService.checkBetaIsPresentAndIsNotNegative(form.getBetaNum())); } Collection<ValidationError> updatedError = ErrorProcessingService.checkForValidErrors(errors); return processAssociationValidationErrors(updatedError); } }
AssociationOperationsService { public List<AssociationValidationView> checkSnpAssociationInteractionFormErrors(SnpAssociationInteractionForm form, String measurementType) { Collection<ValidationError> errors = new ArrayList<>(); for (SnpFormColumn column : form.getSnpFormColumns()) { errors.add(errorCreationService.checkSnpValueIsPresent(column.getSnp())); errors.add(errorCreationService.checkStrongestAlleleValueIsPresent(column.getStrongestRiskAllele())); } if (measurementType.equals("or")) { errors.add(errorCreationService.checkOrIsPresent(form.getOrPerCopyNum())); } if (measurementType.equals("beta")) { errors.add(errorCreationService.checkBetaIsPresentAndIsNotNegative(form.getBetaNum())); } Collection<ValidationError> updatedError = ErrorProcessingService.checkForValidErrors(errors); return processAssociationValidationErrors(updatedError); } @Autowired  AssociationOperationsService(SingleSnpMultiSnpAssociationService singleSnpMultiSnpAssociationService,
                                        SnpInteractionAssociationService snpInteractionAssociationService,
                                        AssociationReportRepository associationReportRepository,
                                        AssociationRepository associationRepository,
                                        LocusRepository locusRepository,
                                        MappingService mappingService,
                                        LociAttributesService lociAttributesService,
                                        ValidationService validationService,
                                        AssociationValidationReportService associationValidationReportService,
                                        ErrorCreationService errorCreationService,
                                        @Qualifier("associationTrackingOperationServiceImpl") TrackingOperationService trackingOperationService,
                                        AssociationMappingErrorService associationMappingErrorService); }
AssociationOperationsService { public List<AssociationValidationView> checkSnpAssociationInteractionFormErrors(SnpAssociationInteractionForm form, String measurementType) { Collection<ValidationError> errors = new ArrayList<>(); for (SnpFormColumn column : form.getSnpFormColumns()) { errors.add(errorCreationService.checkSnpValueIsPresent(column.getSnp())); errors.add(errorCreationService.checkStrongestAlleleValueIsPresent(column.getStrongestRiskAllele())); } if (measurementType.equals("or")) { errors.add(errorCreationService.checkOrIsPresent(form.getOrPerCopyNum())); } if (measurementType.equals("beta")) { errors.add(errorCreationService.checkBetaIsPresentAndIsNotNegative(form.getBetaNum())); } Collection<ValidationError> updatedError = ErrorProcessingService.checkForValidErrors(errors); return processAssociationValidationErrors(updatedError); } @Autowired  AssociationOperationsService(SingleSnpMultiSnpAssociationService singleSnpMultiSnpAssociationService,
                                        SnpInteractionAssociationService snpInteractionAssociationService,
                                        AssociationReportRepository associationReportRepository,
                                        AssociationRepository associationRepository,
                                        LocusRepository locusRepository,
                                        MappingService mappingService,
                                        LociAttributesService lociAttributesService,
                                        ValidationService validationService,
                                        AssociationValidationReportService associationValidationReportService,
                                        ErrorCreationService errorCreationService,
                                        @Qualifier("associationTrackingOperationServiceImpl") TrackingOperationService trackingOperationService,
                                        AssociationMappingErrorService associationMappingErrorService); List<AssociationValidationView> checkSnpAssociationFormErrors(SnpAssociationStandardMultiForm form,
                                                                         String measurementType); List<AssociationValidationView> checkSnpAssociationErrors(Association association,
                                                                         String measurementType); List<AssociationValidationView> checkSnpAssociationInteractionFormErrors(SnpAssociationInteractionForm form,
                                                                                    String measurementType); Collection<AssociationValidationView> saveAssociationCreatedFromForm(Study study,
                                                                                Association association,
                                                                                SecureUser user,
                                                                                String eRelease); Collection<AssociationValidationView> saveEditedAssociationFromForm(Study study,
                                                                               Association association,
                                                                               Long associationId,
                                                                               SecureUser user,
                                                                               String eRelease); Collection<AssociationValidationView> validateAndSaveAssociation(Study study,
                                                                               Association association,
                                                                               SecureUser user,
                                                                               String eRelease); void saveAssociation(Association association, Study study, Collection<ValidationError> errors); void runMapping(Curator curator, Association association, SecureUser user); String determineIfAssociationIsOrType(Association association); SnpAssociationForm generateForm(Association association); MappingDetails createMappingDetails(Association association); LastViewedAssociation getLastViewedAssociation(Long associationId); void approveAssociation(Association association, SecureUser user); void unapproveAssociation(Association association, SecureUser user); void createAssociationCreationEvent(Association association, SecureUser user); void deleteAssocationReport(Long associationReportId); Collection<String> getGenesIds(Collection<Locus> loci); Collection<String> getSpnsName(Collection<SingleNucleotidePolymorphism> snpsList); }
AssociationOperationsService { public List<AssociationValidationView> checkSnpAssociationInteractionFormErrors(SnpAssociationInteractionForm form, String measurementType) { Collection<ValidationError> errors = new ArrayList<>(); for (SnpFormColumn column : form.getSnpFormColumns()) { errors.add(errorCreationService.checkSnpValueIsPresent(column.getSnp())); errors.add(errorCreationService.checkStrongestAlleleValueIsPresent(column.getStrongestRiskAllele())); } if (measurementType.equals("or")) { errors.add(errorCreationService.checkOrIsPresent(form.getOrPerCopyNum())); } if (measurementType.equals("beta")) { errors.add(errorCreationService.checkBetaIsPresentAndIsNotNegative(form.getBetaNum())); } Collection<ValidationError> updatedError = ErrorProcessingService.checkForValidErrors(errors); return processAssociationValidationErrors(updatedError); } @Autowired  AssociationOperationsService(SingleSnpMultiSnpAssociationService singleSnpMultiSnpAssociationService,
                                        SnpInteractionAssociationService snpInteractionAssociationService,
                                        AssociationReportRepository associationReportRepository,
                                        AssociationRepository associationRepository,
                                        LocusRepository locusRepository,
                                        MappingService mappingService,
                                        LociAttributesService lociAttributesService,
                                        ValidationService validationService,
                                        AssociationValidationReportService associationValidationReportService,
                                        ErrorCreationService errorCreationService,
                                        @Qualifier("associationTrackingOperationServiceImpl") TrackingOperationService trackingOperationService,
                                        AssociationMappingErrorService associationMappingErrorService); List<AssociationValidationView> checkSnpAssociationFormErrors(SnpAssociationStandardMultiForm form,
                                                                         String measurementType); List<AssociationValidationView> checkSnpAssociationErrors(Association association,
                                                                         String measurementType); List<AssociationValidationView> checkSnpAssociationInteractionFormErrors(SnpAssociationInteractionForm form,
                                                                                    String measurementType); Collection<AssociationValidationView> saveAssociationCreatedFromForm(Study study,
                                                                                Association association,
                                                                                SecureUser user,
                                                                                String eRelease); Collection<AssociationValidationView> saveEditedAssociationFromForm(Study study,
                                                                               Association association,
                                                                               Long associationId,
                                                                               SecureUser user,
                                                                               String eRelease); Collection<AssociationValidationView> validateAndSaveAssociation(Study study,
                                                                               Association association,
                                                                               SecureUser user,
                                                                               String eRelease); void saveAssociation(Association association, Study study, Collection<ValidationError> errors); void runMapping(Curator curator, Association association, SecureUser user); String determineIfAssociationIsOrType(Association association); SnpAssociationForm generateForm(Association association); MappingDetails createMappingDetails(Association association); LastViewedAssociation getLastViewedAssociation(Long associationId); void approveAssociation(Association association, SecureUser user); void unapproveAssociation(Association association, SecureUser user); void createAssociationCreationEvent(Association association, SecureUser user); void deleteAssocationReport(Long associationReportId); Collection<String> getGenesIds(Collection<Locus> loci); Collection<String> getSpnsName(Collection<SingleNucleotidePolymorphism> snpsList);  }