private void assertExpectednessMultipleTAAE( AbstractStudyInterventionExpectedAE abstractStudyInterventionExpectedAE) { assertEquals("96.13", format(abstractStudyInterventionExpectedAE.getExpectednessFrequency())); assertEquals("21.87", format(abstractStudyInterventionExpectedAE.getGrade1Frequency())); assertEquals("68.50", format(abstractStudyInterventionExpectedAE.getGrade2Frequency())); assertEquals("9.54", format(abstractStudyInterventionExpectedAE.getGrade3Frequency())); assertEquals("79.59", format(abstractStudyInterventionExpectedAE.getGrade4Frequency())); assertEquals("44.56", format(abstractStudyInterventionExpectedAE.getGrade5Frequency())); assertTrue(abstractStudyInterventionExpectedAE.isExpected()); }
private void assertExpectednessUpdatedTAAE( AbstractStudyInterventionExpectedAE abstractStudyInterventionExpectedAE) { assertEquals("84.00", format(abstractStudyInterventionExpectedAE.getExpectednessFrequency())); assertEquals("36.00", format(abstractStudyInterventionExpectedAE.getGrade1Frequency())); assertEquals("19.00", format(abstractStudyInterventionExpectedAE.getGrade2Frequency())); assertEquals("8.49", format(abstractStudyInterventionExpectedAE.getGrade3Frequency())); assertEquals("12.07", format(abstractStudyInterventionExpectedAE.getGrade4Frequency())); assertEquals("68.64", format(abstractStudyInterventionExpectedAE.getGrade5Frequency())); assertFalse(abstractStudyInterventionExpectedAE.isExpected()); }
private void assertExpectednessSingleTAAE( AbstractStudyInterventionExpectedAE abstractStudyInterventionExpectedAE) { assertEquals("60.00", format(abstractStudyInterventionExpectedAE.getExpectednessFrequency())); assertEquals("20.00", format(abstractStudyInterventionExpectedAE.getGrade1Frequency())); assertEquals("10.00", format(abstractStudyInterventionExpectedAE.getGrade2Frequency())); assertEquals("4.34", format(abstractStudyInterventionExpectedAE.getGrade3Frequency())); assertEquals("6.23", format(abstractStudyInterventionExpectedAE.getGrade4Frequency())); assertEquals("44.00", format(abstractStudyInterventionExpectedAE.getGrade5Frequency())); assertFalse(abstractStudyInterventionExpectedAE.isExpected()); }
public void testSynchronizeStudyWithAgent() { { StudyAgent studyAgent = studyAgentDao.getById(-1); Study s = studyDao.getById(-2); System.out.println(s.getExpectedAECtcTerms().size()); service.synchronizeStudyWithAgent(studyAgent, AgentSpecificTerm.EXPTECTED_AE_ADDED); studyDao.save(studyAgent.getStudy()); } interruptSession(); { Study s = studyDao.getById(-2); assertEquals(3, s.getExpectedAECtcTerms().size()); assertEquals(1, s.getExpectedAEMeddraLowLevelTerms().size()); assertEquals( 2, s.getTreatmentAssignments().get(0).getTreatmentAssignmentStudyInterventions().size()); assertEquals( 2, s.getTreatmentAssignments().get(1).getTreatmentAssignmentStudyInterventions().size()); assertEquals( 2, s.getTreatmentAssignments().get(0).getAbstractStudyInterventionExpectedAEs().size()); assertEquals( 2, s.getTreatmentAssignments().get(1).getAbstractStudyInterventionExpectedAEs().size()); assertExpectednessSingleTAAE( s.getTreatmentAssignments() .get(0) .getExistingTerm(agentSpecificTermDao.getById(-1).getTerm())); } interruptSession(); { StudyAgent studyAgent = studyAgentDao.getById(-2); service.synchronizeStudyWithAgent(studyAgent, AgentSpecificTerm.EXPTECTED_AE_ADDED); studyDao.save(studyAgent.getStudy()); } interruptSession(); { Study s = studyDao.getById(-2); assertEquals(6, s.getExpectedAECtcTerms().size()); assertEquals(1, s.getExpectedAEMeddraLowLevelTerms().size()); assertEquals( 2, s.getTreatmentAssignments().get(0).getTreatmentAssignmentStudyInterventions().size()); assertEquals( 2, s.getTreatmentAssignments().get(1).getTreatmentAssignmentStudyInterventions().size()); assertEquals( 4, s.getTreatmentAssignments().get(0).getAbstractStudyInterventionExpectedAEs().size()); assertEquals( 4, s.getTreatmentAssignments().get(1).getAbstractStudyInterventionExpectedAEs().size()); assertExpectednessMultipleTAAE( s.getTreatmentAssignments() .get(0) .getExistingTerm(agentSpecificTermDao.getById(-1).getTerm())); StudyAgent studyAgent = studyAgentDao.getById(-2); service.synchronizeStudyWithAgent(studyAgent, AgentSpecificTerm.EXPTECTED_AE_ADDED); studyDao.save(studyAgent.getStudy()); } interruptSession(); { Study s = studyDao.getById(-2); assertEquals(6, s.getExpectedAECtcTerms().size()); assertEquals(1, s.getExpectedAEMeddraLowLevelTerms().size()); assertEquals( 2, s.getTreatmentAssignments().get(0).getTreatmentAssignmentStudyInterventions().size()); assertEquals( 2, s.getTreatmentAssignments().get(1).getTreatmentAssignmentStudyInterventions().size()); assertEquals( 4, s.getTreatmentAssignments().get(0).getAbstractStudyInterventionExpectedAEs().size()); assertEquals( 4, s.getTreatmentAssignments().get(1).getAbstractStudyInterventionExpectedAEs().size()); assertExpectednessMultipleTAAE( s.getTreatmentAssignments() .get(0) .getExistingTerm(agentSpecificTermDao.getById(-1).getTerm())); } interruptSession(); { Study s = studyDao.getById(-2); s.getExpectedAECtcTerms().size(); s.getExpectedAEMeddraLowLevelTerms().size(); for (TreatmentAssignment ta : s.getTreatmentAssignments()) { ta.getTreatmentAssignmentStudyInterventions().size(); for (AbstractStudyInterventionExpectedAE as : ta.getAbstractStudyInterventionExpectedAEs()) { as.getTreatmentAssignmentAgents().size(); } } for (StudyAgent sa : s.getStudyAgents()) { if (sa.getAgent() != null) { sa.getAgent().getAgentSpecificTerms().size(); sa.getTreatmentAssignmentAgents().size(); } } } interruptSession(); { Study s = studyDao.getById(-2); StudyAgent studyAgent = s.getStudyAgents().get(0); studyAgent.retire(); service.synchronizeStudyWithAgent(studyAgent, AgentSpecificTerm.EXPTECTED_AE_DELETED); studyAgent.removeTreatmentAssignmentAgents(); studyDao.save(studyAgent.getStudy()); interruptSession(); s = studyDao.getById(-2); for (ExpectedAECtcTerm ex_ae : s.getExpectedAECtcTerms()) { System.out.println(ex_ae.getCtcTerm().getCtepTerm()); } assertEquals(4, s.getExpectedAECtcTerms().size()); assertEquals(1, s.getExpectedAEMeddraLowLevelTerms().size()); assertEquals( 1, s.getTreatmentAssignments().get(0).getTreatmentAssignmentStudyInterventions().size()); assertEquals( 1, s.getTreatmentAssignments().get(1).getTreatmentAssignmentStudyInterventions().size()); assertEquals( 2, s.getTreatmentAssignments().get(0).getAbstractStudyInterventionExpectedAEs().size()); assertEquals( 2, s.getTreatmentAssignments().get(1).getAbstractStudyInterventionExpectedAEs().size()); assertExpectednessSingleTAAE( s.getTreatmentAssignments() .get(0) .getExistingTerm(agentSpecificTermDao.getById(-1).getTerm())); } }