@Test
public void testGetReferences() throws Exception {

	Playlist playlist1 = new Playlist("d1");
	playlist1 = playlistService.createPlaylist(playlist1);
	Playlist playlist2 = new Playlist("d2");
	playlist2 = playlistService.createPlaylist(playlist2);
	Playlist playlist3 = new Playlist("d3");
	playlist3 = playlistService.createPlaylist(playlist3);
	Page page1 = pageService.createPage(new Page("p1"));
	Page page2 = pageService.createPage(new Page("p2"));
	playlist1 = playlistService.addPage(playlist1.getId(), page1);
	playlist1 = playlistService.addPage(playlist1.getId(), page2);
	playlist2 = playlistService.addPage(playlist2.getId(), page1);
	playlist3 = playlistService.addPage(playlist3.getId(), page1);
	// one playlist where user is not owner
	playlist3.getOwners().clear();
	playlist3 = PlaylistDAO.save(playlist3);
	PageReferences refs = pageService.getReferences(page1.getId());
	assertEquals(2, refs.getUserPlaylists().size());
	assertEquals(1, refs.getForeignPlaylists());
	refs = pageService.getReferences(page2.getId());
	assertEquals(1, refs.getUserPlaylists().size());
	assertEquals(0, refs.getForeignPlaylists());
}