use of org.survey.model.file.File in project survey by markoniemi.
the class FileRepositoryTest method findAllByFilename.
@Test
public void findAllByFilename() {
save();
File originalFile1 = orginalEntities.get(0);
@SuppressWarnings("unchecked") List<File> files = IteratorUtils.toList(fileRepository.findAllByFilename(originalFile1.getFilename()).iterator());
Assert.assertEquals(1, files.size());
Assert.assertEquals(0, entityComparator.compare(originalFile1, files.get(0)));
}
use of org.survey.model.file.File in project survey by markoniemi.
the class FileControllerTest method deleteFile.
@Test
public void deleteFile() throws Exception {
MockHttpServletRequestBuilder request = MockMvcRequestBuilders.post("/file/delete/" + 1);
ResultActions resultActions = mockMvc.perform(request);
resultActions.andExpect(MockMvcResultMatchers.status().is3xxRedirection());
resultActions.andExpect(MockMvcResultMatchers.redirectedUrl("/file/files"));
ModelAndView modelAndView = resultActions.andReturn().getModelAndView();
File[] files = (File[]) modelAndView.getModel().get("files");
Assert.assertNull(files);
}
use of org.survey.model.file.File in project survey by markoniemi.
the class FileServiceTestBase method findOne.
@Test
public void findOne() {
create();
for (int i = 0; i < ENTITY_COUNT; i++) {
File savedEntity = savedEntities.get(i);
File foundEntity = entityService.findOne(savedEntity.getId());
assertEntity(savedEntities.get(i), foundEntity);
}
// TODO how to test a non-existent entity?
}
use of org.survey.model.file.File in project survey by markoniemi.
the class FileServiceTestBase method create.
@Test
public void create() {
orginalEntities = entityFactory.getEntities(ENTITY_COUNT);
for (int i = 0; i < ENTITY_COUNT; i++) {
File originalEntity = orginalEntities.get(i);
File savedEntity = entityService.create(originalEntity);
savedEntities.add(savedEntity);
assertEntity(originalEntity, savedEntity);
}
}
use of org.survey.model.file.File in project survey by markoniemi.
the class FileServiceTestBase method tearDown.
@After
public void tearDown() throws SQLException {
File[] users = entityService.findAll();
if (users != null) {
for (File fileToDelete : users) {
entityService.delete(fileToDelete.getId());
}
}
userService.delete(user.getUsername());
}
Aggregations