use of org.neo4j.ogm.domain.social.User in project neo4j-ogm by neo4j.
the class BasicDriverTest method shouldLoadOne.
@Test
public void shouldLoadOne() {
User user = new User();
session.save(user);
session.clear();
User userByType = session.load(User.class, user.getId());
assertThat(userByType).isNotNull();
}
use of org.neo4j.ogm.domain.social.User in project neo4j-ogm by neo4j.
the class BasicDriverTest method shouldNotFindExplicitlyRolledBackEntity.
@Test
public void shouldNotFindExplicitlyRolledBackEntity() {
Transaction tx = session.beginTransaction();
session.save(new User());
tx.rollback();
session.clear();
assertThat(session.loadAll(User.class)).isEmpty();
}
use of org.neo4j.ogm.domain.social.User in project neo4j-ogm by neo4j.
the class BasicDriverTest method shouldWrapUnderlyingException.
// GH-119
@Test
public void shouldWrapUnderlyingException() {
session.save(new User("Bilbo Baggins"));
try {
session.query(User.class, "MATCH(u:User) WHERE u.name ~ '.*Baggins' RETURN u", Collections.emptyMap());
fail("Expected a CypherException but got none");
} catch (CypherException ce) {
assertThat(ce.getCode().contains("Neo.ClientError.Statement")).isTrue();
}
}
use of org.neo4j.ogm.domain.social.User in project neo4j-ogm by neo4j.
the class BasicDriverTest method shouldQueryForDomainObjects.
@Test
public void shouldQueryForDomainObjects() {
session.save(new User("Bilbo Baggins"));
session.save(new User("Frodo Baggins"));
session.clear();
Collection<User> users = (Collection) session.query(User.class, "MATCH(u:User) WHERE u.name =~ '.*Baggins' RETURN u", Collections.emptyMap());
assertThat(users).isNotNull();
assertThat(users).hasSize(2);
}
use of org.neo4j.ogm.domain.social.User in project neo4j-ogm by neo4j.
the class BasicDriverTest method shouldLoadByType.
// load tests
@Test
public void shouldLoadByType() {
session.save(new User());
session.clear();
assertThat(session.loadAll(User.class)).hasSize(1);
}
Aggregations