@Test public void create_panel_without_tests() throws Exception { panelService.createOrUpdate(referenceDataPanel); Panel savedPanel = panelDAO.getPanelByName("Panel Name"); assertNotNull(savedPanel); assertEquals("Panel Name", savedPanel.getDescription()); List panelTestAssoc = panelItemDAO.getPanelItemsForPanel(savedPanel.getId()); assertEquals(0, panelTestAssoc.size()); }
@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()); }