@Test
public void testGetReferences() throws Exception {

	UploadHelper.simulateFileUpload(requestMock, "testtemplate.zip", "application/zip");
	fileService.uploadFile();
	File template = fileService.getFiles(null).get(0);
	File file1 = fileService.createFile("f1", "jpg", "f1", 99);
	Page page1 = new Page("p1");
	page1.setFile(file1);
	page1 = pageService.createPage(page1);
	Page page2 = new Page("p2");
	page2.setFile(file1);
	page2 = pageService.createPage(page2);
	// one page where user is not owner
	page2.getOwners().clear();
	page2 = PageDAO.save(page2);
	FileReferences refs = fileService.getReferences(file1.getId());
	assertEquals(1, refs.getUserPages().size());
	assertEquals(1, refs.getForeignPages());
	// used in template
	Page page3 = new Page("p3");
	page3.setPageType(PageType.TEMPLATE);
	page3.setFile(template);
	page3.setTemplateValues("{\"image\":\"" + file1.getId() + "\"}");
	page3 = pageService.createPage(page3);
	refs = fileService.getReferences(file1.getId());
	assertEquals(2, refs.getUserPages().size());
	assertEquals(1, refs.getForeignPages());
}