AboutTextManager implements IAboutTextManager { @Transactional @Override public IAboutText getAboutTextByProjectId(String projectId) throws QuadrigaStorageException { AboutTextDTO abtDTO = aboutTextDAO.getDTOByProjectId(projectId); if (abtDTO != null) { return abtTxtMapper.aboutTextDTOtoBean(abtDTO); } return null; }  @Transactional @Override void saveAbout(String projectId, IAboutText abtText); @Transactional @Override IAboutText getAboutTextByProjectId(String projectId);  }
@Test public void test_getAboutTextByProjectId_existingProject() throws QuadrigaStorageException { AboutTextDTO dto = new AboutTextDTO(); dto.setProjectId("test1"); dto.setTitle("TestTitle"); dto.setDescription("Newestdescription"); dto.setId("Test1"); Mockito.when(mockedAboutTextDAO.getDTOByProjectId("test1")).thenReturn(dto); IAboutText result = aboutTextManager.getAboutTextByProjectId("test1"); Mockito.verify(mockedAboutTextDAO, Mockito.times(1)).getDTOByProjectId("test1"); assertNotNull(result); assertEquals("test1", result.getProjectId()); assertEquals("TestTitle", result.getTitle()); assertEquals("Newestdescription", result.getDescription()); assertEquals("Test1", result.getId()); }
@Test public void test_getAboutTextByProjectId_emptyProject() throws QuadrigaStorageException { Mockito.when(mockedAboutTextDAO.getDTOByProjectId("test24")).thenReturn(null); IAboutText abtText = aboutTextManager.getAboutTextByProjectId("test24"); assertNull(abtText); }