use of uk.ac.bbsrc.tgac.miso.core.data.Study in project miso-lims by miso-lims.
the class DefaultStudyServiceTest method testSaveStudy.
@Test
public void testSaveStudy() throws IOException {
StudyType st = new StudyType();
st.setId(2L);
st.setName("Test");
when(studyTypeDao.get(2L)).thenReturn(st);
Study s = new StudyImpl();
s.setId(1L);
s.setName("a");
s.setDescription("desc");
s.setStudyType(st);
Study db = new StudyImpl();
db.setId(1L);
db.setName("b");
db.setDescription("mt");
s.setStudyType(st);
when(studyStore.get(1L)).thenReturn(db);
when(studyStore.save(db)).thenReturn(1L);
assertEquals(1L, sut.update(s));
assertEquals(s.getDescription(), db.getDescription());
assertNotEquals(s.getName(), db.getName());
}
use of uk.ac.bbsrc.tgac.miso.core.data.Study in project miso-lims by miso-lims.
the class DefaultStudyServiceTest method testGetStudyByIdThrows.
@Test
public void testGetStudyByIdThrows() throws IOException {
Study db = new StudyImpl();
db.setId(1L);
db.setName("b");
db.setDescription("mt");
when(studyStore.get(1L)).thenReturn(db);
assertEquals(db, sut.get(1L));
}
use of uk.ac.bbsrc.tgac.miso.core.data.Study in project miso-lims by miso-lims.
the class HibernateStudyDaoIT method testGetUsage.
@Test
public void testGetUsage() throws Exception {
Study study = (Study) currentSession().get(StudyImpl.class, 1L);
assertEquals(25L, dao.getUsage(study));
}
use of uk.ac.bbsrc.tgac.miso.core.data.Study in project miso-lims by miso-lims.
the class HibernateStudyDaoIT method makeStudy.
private Study makeStudy() {
User user = new UserImpl();
user.setId(1L);
Project project = new ProjectImpl();
project.setId(1L);
StudyType studyType = new StudyType();
studyType.setId(1L);
Study s = new StudyImpl();
s.setName("STU999");
s.setStudyType(studyType);
s.setDescription("foo");
s.setProject(project);
s.setChangeDetails(user);
return s;
}
Aggregations