@Test
  public void sample_save_should_form_test_to_sample_associations() throws Exception {
    testService.createOrUpdate(referenceDataTest);
    us.mn.state.health.lims.test.valueholder.Test savedTest = testDAO.getTestByName("Test Name");
    assertEquals("Test Name", savedTest.getTestName());
    assertEquals("New", savedTest.getTestSection().getTestSectionName());

    referenceDataSample.addTest(
        new MinimalResource(referenceDataTest.getId(), referenceDataTest.getName()));
    typeOfSampleService.createOrUpdate(referenceDataSample);
    TypeOfSample savedSample = typeOfSampleDAO.getTypeOfSampleByUUID(sampleUuid);
    assertEquals("Sample Name", savedSample.getDescription());
    assertEquals("Sample Name", savedSample.getLocalAbbreviation());
    TypeOfSampleTest sampleTestAssoc =
        typeOfSampleTestDAO.getTypeOfSampleTestForTest(savedTest.getId());
    assertNotNull(sampleTestAssoc);
    assertEquals(savedTest.getId(), sampleTestAssoc.getTestId());
    assertEquals(savedSample.getId(), sampleTestAssoc.getTypeOfSampleId());
  }
示例#2
0
  @Test
  public void associate_tests_with_panel() throws Exception {
    testService.createOrUpdate(referenceDataTest);

    us.mn.state.health.lims.test.valueholder.Test savedTest = testDAO.getTestByName("Test Name");
    assertEquals("Test Name", savedTest.getTestName());
    assertEquals("New", savedTest.getTestSection().getTestSectionName());

    referenceDataPanel.addTest(
        new MinimalResource(referenceDataTest.getId(), referenceDataTest.getName()));
    panelService.createOrUpdate(referenceDataPanel);

    Panel savedPanel = panelDAO.getPanelByName("Panel Name");
    assertNotNull(savedPanel);
    assertEquals("Panel Name", savedPanel.getDescription());

    List panelTestAssoc = panelItemDAO.getPanelItemsForPanel(savedPanel.getId());
    assertNotNull(panelTestAssoc);
    assertEquals(1, panelTestAssoc.size());
    PanelItem panelItem = (PanelItem) panelTestAssoc.get(0);
    assertEquals(savedTest.getId(), panelItem.getTest().getId());
  }