package eu.dnetlib.r2d2.neo4j;

import org.junit.Test;

import eu.dnetlib.r2d2.neo4j.domain.Neo4jProfile;

public class TestDelete extends BaseTestCase {

	String profId = "profId";
	
	@Test
	public void testSameTx() {
		Neo4jProfile prof = profileDao.newBean(profId);
		
		prof.setName("Vaggelis");
		prof.setAvatarUrl("url");
		prof.setName(null);
		
		profileDao.deleteBean(profId);
		
		prof = profileDao.getBean(profId);
		
		assertFalse(profileDao.beanExists(profId));
		assertNull(prof);
	}
	
	@Test
	public void testDifferentTx() {
		Neo4jProfile prof = profileDao.newBean(profId);
		
		prof.setName("Vaggelis");
		prof.setAvatarUrl("url");
		prof.setName(null);
		
		after();
		before();
		
		profileDao.deleteBean(profId);
		
		prof = profileDao.getBean(profId);
		
		assertFalse(profileDao.beanExists(profId));
		assertNull(prof);
	}
}