Skip to content

Commit 86c59b2

Browse files
committed
feat: include n4oj library
Signed-off-by: Otavio Santana <[email protected]>
1 parent 2d87330 commit 86c59b2

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

jnosql-neo4j/src/test/java/org/eclipse/jnosql/databases/neo4j/communication/Neo4JDatabaseManagerTest.java

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,16 @@
1919
import net.datafaker.Faker;
2020
import org.assertj.core.api.SoftAssertions;
2121
import org.eclipse.jnosql.communication.semistructured.CommunicationEntity;
22+
import org.eclipse.jnosql.communication.semistructured.CriteriaCondition;
2223
import org.eclipse.jnosql.communication.semistructured.Element;
2324
import org.eclipse.jnosql.communication.semistructured.Elements;
25+
import org.eclipse.jnosql.mapping.semistructured.MappingQuery;
2426
import org.junit.jupiter.api.BeforeAll;
2527
import org.junit.jupiter.api.BeforeEach;
2628
import org.junit.jupiter.api.Test;
2729
import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
2830

31+
import java.util.Collections;
2932
import java.util.HashMap;
3033
import java.util.List;
3134
import java.util.Map;
@@ -607,6 +610,51 @@ void shouldCreateEdgeWithProperties() {
607610
});
608611
}
609612

613+
@Test
614+
void shouldFindContains() {
615+
var entity = getEntity();
616+
617+
entityManager.insert(entity);
618+
var query = new MappingQuery(Collections.emptyList(), 0L, 0L, CriteriaCondition.contains(Element.of("name",
619+
"lia")), COLLECTION_NAME, Collections.emptyList());
620+
621+
var result = entityManager.select(query).toList();
622+
SoftAssertions.assertSoftly(softly -> {
623+
softly.assertThat(result).hasSize(1);
624+
softly.assertThat(result.get(0).find("name").orElseThrow().get(String.class)).isEqualTo("Poliana");
625+
});
626+
}
627+
628+
@Test
629+
void shouldStartsWith() {
630+
var entity = getEntity();
631+
632+
entityManager.insert(entity);
633+
var query = new MappingQuery(Collections.emptyList(), 0L, 0L, CriteriaCondition.startsWith(Element.of("name",
634+
"Pol")), COLLECTION_NAME, Collections.emptyList());
635+
636+
var result = entityManager.select(query).toList();
637+
SoftAssertions.assertSoftly(softly -> {
638+
softly.assertThat(result).hasSize(1);
639+
softly.assertThat(result.get(0).find("name").orElseThrow().get(String.class)).isEqualTo("Poliana");
640+
});
641+
}
642+
643+
@Test
644+
void shouldEndsWith() {
645+
var entity = getEntity();
646+
647+
entityManager.insert(entity);
648+
var query = new MappingQuery(Collections.emptyList(), 0L, 0L, CriteriaCondition.endsWith(Element.of("name",
649+
"ana")), COLLECTION_NAME, Collections.emptyList());
650+
651+
var result = entityManager.select(query).toList();
652+
SoftAssertions.assertSoftly(softly -> {
653+
softly.assertThat(result).hasSize(1);
654+
softly.assertThat(result.get(0).find("name").orElseThrow().get(String.class)).isEqualTo("Poliana");
655+
});
656+
}
657+
610658
private CommunicationEntity getEntity() {
611659
Faker faker = new Faker();
612660

0 commit comments

Comments
 (0)