Skip to content

Commit 465a4a9

Browse files
committed
Add beforeeach method to delete all data from mongodb database
Signed-off-by: Otavio Santana <[email protected]>
1 parent b2111b6 commit 465a4a9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

mongodb-driver/src/test/java/org/eclipse/jnosql/communication/mongodb/document/MongoDBQueryTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@
1717

1818
import jakarta.nosql.document.Document;
1919
import jakarta.nosql.document.DocumentCollectionManager;
20+
import jakarta.nosql.document.DocumentDeleteQuery;
2021
import jakarta.nosql.document.DocumentEntity;
2122
import jakarta.nosql.document.DocumentQuery;
2223
import org.eclipse.jnosql.communication.document.Documents;
2324
import org.junit.jupiter.api.Assertions;
2425
import org.junit.jupiter.api.BeforeAll;
26+
import org.junit.jupiter.api.BeforeEach;
2527
import org.junit.jupiter.api.DisplayName;
2628
import org.junit.jupiter.api.Test;
2729

@@ -44,6 +46,11 @@ public static void setUp() throws IOException {
4446
entityManager = ManagerFactorySupplier.INSTANCE.get("database");
4547
}
4648

49+
@BeforeEach
50+
public void beforeEach() {
51+
DocumentDeleteQuery.delete().from(COLLECTION_NAME).delete(entityManager);
52+
}
53+
4754
@Test
4855
@DisplayName("The query should execute A or B")
4956
public void shouldQuery() {

0 commit comments

Comments
 (0)