File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
jnosql-neo4j/src/test/java/org/eclipse/jnosql/databases/neo4j/integration Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 3232import org .junit .jupiter .api .Test ;
3333import org .junit .jupiter .api .condition .EnabledIfSystemProperty ;
3434
35+ import java .util .HashMap ;
3536import java .util .Optional ;
3637
3738import static org .assertj .core .api .Assertions .assertThat ;
@@ -58,6 +59,7 @@ public class TemplateIntegrationTest {
5859
5960 @ BeforeEach
6061 void setUp () {
62+ removeAllEdges ();
6163 template .delete (Magazine .class ).execute ();
6264 }
6365
@@ -146,4 +148,15 @@ void shouldCreateEdgeFromNullId() {
146148 soft .assertThat (magazineEdge .id ()).isPresent ();
147149 });
148150 }
151+
152+ private void removeAllEdges () {
153+ String cypher = "MATCH ()-[r]-() DELETE r" ;
154+
155+ try {
156+ var entityManager = DatabaseContainer .INSTANCE .get ("neo4j" );
157+ entityManager .executeQuery (cypher , new HashMap <>()).toList ();
158+ } catch (Exception e ) {
159+ throw new RuntimeException ("Failed to remove edges before node deletion" , e );
160+ }
161+ }
149162}
You can’t perform that action at this time.
0 commit comments