Skip to content

Commit 3d32647

Browse files
committed
test: create template integration
Signed-off-by: Otavio Santana <[email protected]>
1 parent a0ffa11 commit 3d32647

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

jnosql-neo4j/src/test/java/org/eclipse/jnosql/databases/neo4j/integration/TemplateIntegrationTest.java

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
package org.eclipse.jnosql.databases.neo4j.integration;
1616

1717
import jakarta.inject.Inject;
18+
import org.assertj.core.api.SoftAssertions;
1819
import org.eclipse.jnosql.databases.neo4j.communication.DatabaseContainer;
1920
import org.eclipse.jnosql.databases.neo4j.communication.Neo4JConfigurations;
2021
import org.eclipse.jnosql.databases.neo4j.mapping.Neo4JTemplate;
@@ -117,6 +118,32 @@ void shouldCreateEdge() {
117118
Magazine firstEdition = template.insert(new Magazine(null, "Effective Java", 1));
118119
Magazine secondEdition = template.insert(new Magazine(null, "Effective Java", 2));
119120
Edge<Magazine, Magazine> edge = Edge.source(firstEdition).label("NEXT").target(secondEdition).property("year", 2025).build();
120-
template.edge(edge);
121+
Edge<Magazine, Magazine> magazineEdge = template.edge(edge);
122+
123+
SoftAssertions.assertSoftly(soft -> {
124+
soft.assertThat(magazineEdge.source()).isEqualTo(firstEdition);
125+
soft.assertThat(magazineEdge.target()).isEqualTo(secondEdition);
126+
soft.assertThat(magazineEdge.label()).isEqualTo("NEXT");
127+
soft.assertThat(magazineEdge.property("year", Integer.class)).contains(2025);
128+
soft.assertThat(magazineEdge.id()).isPresent();
129+
});
130+
}
131+
132+
@Test
133+
void shouldCreateEdgeFromNullId() {
134+
Magazine firstEdition = new Magazine(null, "Effective Java", 1);
135+
Magazine secondEdition = new Magazine(null, "Effective Java", 2);
136+
Edge<Magazine, Magazine> edge = Edge.source(firstEdition).label("NEXT").target(secondEdition).property("year", 2025).build();
137+
Edge<Magazine, Magazine> magazineEdge = template.edge(edge);
138+
139+
SoftAssertions.assertSoftly(soft -> {
140+
soft.assertThat(magazineEdge.source()).isNotNull();
141+
soft.assertThat(magazineEdge.source().id()).isNotNull();
142+
soft.assertThat(magazineEdge.target()).isNotNull();
143+
soft.assertThat(magazineEdge.target().id()).isNotNull();
144+
soft.assertThat(magazineEdge.label()).isEqualTo("NEXT");
145+
soft.assertThat(magazineEdge.property("year", Integer.class)).contains(2025);
146+
soft.assertThat(magazineEdge.id()).isPresent();
147+
});
121148
}
122149
}

0 commit comments

Comments
 (0)