use of com.artezio.arttime.filter.Filter in project ART-TIME by Artezio.
the class FilterRepositoryTest method testFind_ByOwnerAndName_ifNotFound.
@Test
public void testFind_ByOwnerAndName_ifNotFound() {
Filter unexpected = new Filter("favorite_filter", "filter_owmer", true);
entityManager.persist(unexpected);
Filter actual = filterRepository.find("me", "favorite_filter");
assertNull(actual);
}
use of com.artezio.arttime.filter.Filter in project ART-TIME by Artezio.
the class FilterRepositoryTest method createFilter.
private Filter createFilter(String owner) {
Filter filter = new Filter();
filter.setOwner(owner);
return filter;
}
use of com.artezio.arttime.filter.Filter in project ART-TIME by Artezio.
the class FilterRepositoryTest method testUpdate.
@Test
public void testUpdate() {
Filter filter = new Filter();
entityManager.persist(filter);
filter.setName("new filter name");
filterRepository.update(filter);
Filter actual = entityManager.find(Filter.class, filter.getId());
assertEquals(filter.getName(), actual.getName());
}
use of com.artezio.arttime.filter.Filter in project ART-TIME by Artezio.
the class FilterRepositoryTest method testFetchDetails_ifFilterNoPersisted.
@Test
public void testFetchDetails_ifFilterNoPersisted() throws NoSuchMethodException, SecurityException, NoSuchFieldException {
Filter filter = new Filter();
Project project = new Project();
List<Project> projects = Arrays.asList(project);
filter.setProjects(projects);
Project projectLoaded = new Project();
List<Project> projectsLoaded = Arrays.asList(projectLoaded);
entityManager.persist(project);
entityManager.persist(projectLoaded);
Method fetchCompleteMethod = ProjectRepository.class.getMethod("fetchComplete", List.class);
projectRepository = EasyMock.createMockBuilder(ProjectRepository.class).addMockedMethod(fetchCompleteMethod).createMock();
setField(filterRepository, "projectRepository", projectRepository);
EasyMock.expect(projectRepository.fetchComplete(projects)).andReturn(projectsLoaded);
EasyMock.replay(projectRepository);
filterRepository.fetchDetails(filter);
EasyMock.verify(projectRepository);
assertSame(projectLoaded, filter.getProjects().get(0));
}
use of com.artezio.arttime.filter.Filter in project ART-TIME by Artezio.
the class FilterRepositoryTest method testFind_ByOwnerAndName_ifFound.
@Test
public void testFind_ByOwnerAndName_ifFound() {
Filter unexpected = new Filter("favorite_filter1", "filter_owmer", true);
Filter expected = new Filter("favorite_filter2", "filter_owmer", true);
entityManager.persist(unexpected);
entityManager.persist(expected);
Filter actual = filterRepository.find("filter_owmer", "favorite_filter2");
assertEquals(expected, actual);
}
Aggregations