Skip to content

Commit 72a210a

Browse files
committed
Create validation to aggregate
Signed-off-by: Otavio Santana <[email protected]>
1 parent e2ad27a commit 72a210a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.junit.jupiter.api.Test;
2828

2929
import java.io.IOException;
30+
import java.util.Collections;
3031
import java.util.HashMap;
3132
import java.util.List;
3233
import java.util.Map;
@@ -99,6 +100,19 @@ public void shouldDelete() {
99100
Assertions.assertTrue(entities.isEmpty());
100101
}
101102

103+
@Test
104+
public void shouldReturnErrorOnAggregateWhenThereIsNullParameter(){
105+
Assertions.assertThrows(NullPointerException.class,
106+
() -> entityManager.aggregate(null, null));
107+
Assertions.assertThrows(NullPointerException.class,
108+
() -> entityManager.aggregate(COLLECTION_NAME, null));
109+
110+
Assertions.assertThrows(NullPointerException.class,
111+
() -> entityManager.aggregate(null,
112+
Collections.singletonList(eq("name", "Poliana"))));
113+
}
114+
115+
102116
private DocumentEntity getEntity() {
103117
DocumentEntity entity = DocumentEntity.of(COLLECTION_NAME);
104118
Map<String, Object> map = new HashMap<>();

0 commit comments

Comments
 (0)