Code example for EntityManagerHolder

0
		EntityManager em = mock(EntityManager.class,"em"); 
		em.contains("foo"); 
		em.contains("bar"); 
		em.merge("bar"); 
		em.flush(); 
		TransactionSynchronizationManager.bindResource(emf, new EntityManagerHolder(em)); 
 
		List<String> items = Arrays.asList(new String[] { "foo", "bar" }); 
 
		writer.write(items); 
 
		TransactionSynchronizationManager.unbindResource(emf); 
	} 
 
	@Test 
	public void testWriteAndFlushWithFailure() throws Exception { 
		final RuntimeException ex = new RuntimeException("ERROR"); 
		EntityManager em = mock(EntityManager.class,"em"); 
		em.contains("foo"); 
		em.contains("bar"); 
Contextual code suggestions in your IDE  Get Codota for Java