@Test
	public void testFindValidVotes() {
		byte[][] vote0 = new byte[][] { Security.encryptExponentialElgamal(1l, pubKey),
				Security.encryptExponentialElgamal(0l, pubKey), Security.encryptExponentialElgamal(0l, pubKey) };
		byte[][] vote1 = new byte[][] { Security.encryptExponentialElgamal(0l, pubKey),
				Security.encryptExponentialElgamal(1l, pubKey), Security.encryptExponentialElgamal(0l, pubKey) };
		byte[][] vote2 = new byte[][] { Security.encryptExponentialElgamal(0l, pubKey),
				Security.encryptExponentialElgamal(0l, pubKey), Security.encryptExponentialElgamal(1l, pubKey) };

		Vote v1 = new Vote("-1", vote0, 1000);
		Vote v2 = new Vote("-1", vote1, 2000);
		Vote v3 = new Vote("-1", vote2, 3000);
		
		EntityManager entMgr = EntityManagerUtil.getEntityManager();
		entMgr.getTransaction().begin();

		entMgr.persist(v1);
		entMgr.persist(v2);
		entMgr.persist(v3);

		VoteRepository vr = new VoteRepository(entMgr);
		
		List<Vote> allVotes = vr.findAll();
		if(!allVotes.contains(v1)) {
			fail("Did not find v1");
		}
		if(!allVotes.contains(v2)) {
			fail("Did not find v2");
		}
		if(!allVotes.contains(v3)) {
			fail("Did not find v3");
		}
		
		List<Vote> validVotes = vr.findAllValid();
		if(validVotes.contains(v1) || validVotes.contains(v2)) {
			fail("Old vote found");
		}
		
		entMgr.getTransaction().commit();
		entMgr.getEntityManagerFactory().close();
	}