Skip to content

Commit 35daf71

Browse files
committed
test: generate scenarion on oracle nosql where the parameter is an enum
Signed-off-by: Otavio Santana <[email protected]>
1 parent 629d288 commit 35daf71

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

jnosql-oracle-nosql/src/test/java/org/eclipse/jnosql/databases/oracle/communication/OracleNoSQLDocumentManagerTest.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,27 @@ void shouldInsertAndRetrieveWithEnum() {
584584
});
585585
}
586586

587+
@Test
588+
void shouldDoQueryUsingEnumAsParameter() {
589+
var entity = CommunicationEntity.of(COLLECTION_NAME);
590+
String id = UUID.randomUUID().toString();
591+
entity.add("_id", id);
592+
entity.add("name", "Test Name");
593+
entity.add("contact_type", ContactType.EMAIL);
594+
entityManager.insert(entity);
595+
596+
var query = select().from(COLLECTION_NAME)
597+
.where("contact_type").eq(ContactType.EMAIL).build();
598+
Optional<CommunicationEntity> optional = entityManager.select(query).findFirst();
599+
SoftAssertions.assertSoftly(soft -> {
600+
soft.assertThat(optional).isPresent();
601+
CommunicationEntity documentEntity = optional.get();
602+
soft.assertThat(documentEntity.find("name").orElseThrow().get(String.class)).isEqualTo("Test Name");
603+
soft.assertThat(documentEntity.find("contact_type").orElseThrow().get(ContactType.class))
604+
.isEqualTo(ContactType.EMAIL);
605+
});
606+
}
607+
587608
private CommunicationEntity createDocumentList() {
588609
var entity = CommunicationEntity.of("AppointmentBook");
589610
entity.add(Element.of("_id", new Random().nextInt()));

0 commit comments

Comments
 (0)