1717
1818import  jakarta .inject .Inject ;
1919import  org .assertj .core .api .SoftAssertions ;
20+ import  org .eclipse .jnosql .databases .oracle .communication .ContactType ;
2021import  org .eclipse .jnosql .databases .oracle .communication .Database ;
2122import  org .eclipse .jnosql .databases .oracle .communication .OracleNoSQLConfigurations ;
2223import  org .eclipse .jnosql .databases .oracle .mapping .OracleNoSQLTemplate ;
3233import  org .jboss .weld .junit5 .auto .EnableAutoWeld ;
3334import  org .junit .jupiter .api .Test ;
3435import  org .junit .jupiter .api .condition .EnabledIfSystemProperty ;
36+ import  org .junit .jupiter .params .ParameterizedTest ;
3537
38+ import  java .util .List ;
3639import  java .util .Optional ;
3740
3841import  static  java .util .UUID .randomUUID ;
@@ -54,6 +57,9 @@ class OracleNoSQLTemplateIntegrationTest {
5457    @ Inject 
5558    private  OracleNoSQLTemplate  template ;
5659
60+     @ Inject 
61+     private  ContactRepository  contactRepository ;
62+ 
5763    static  {
5864        System .setProperty (OracleNoSQLConfigurations .HOST .get (), Database .INSTANCE .host ());
5965        System .setProperty (MappingConfigurations .DOCUMENT_DATABASE .get (), "library" );
@@ -136,6 +142,36 @@ void shouldUpdateNullValues(){
136142            softly .assertThat (optional ).get ().extracting (Magazine ::edition ).isEqualTo (2 );
137143        });
138144    }
145+ 
146+     @ ParameterizedTest 
147+     @ org .junit .jupiter .params .provider .EnumSource (ContactType .class )
148+     void  shouldFindByType (ContactType  type ){
149+         var  contact  = new  Contact (randomUUID ().toString (), "Otavio Santana" , type );
150+         template .insert (contact );
151+ 
152+         List <Contact > entities  = template .select (Contact .class ).where ("type" ).eq (type ).result ();
153+ 
154+         SoftAssertions .assertSoftly (softly  -> {
155+             softly .assertThat (entities ).isNotNull ();
156+             softly .assertThat (entities ).allMatch (e  -> e .type ().equals (type ));
157+         });
158+ 
159+     }
160+ 
161+     @ ParameterizedTest 
162+     @ org .junit .jupiter .params .provider .EnumSource (ContactType .class )
163+     void  shouldFindByTypeUsingRepository (ContactType  type ){
164+         var  contact  = new  Contact (randomUUID ().toString (), "Otavio Santana" , type );
165+         contactRepository .save (contact );
166+ 
167+         List <Contact > entities  = contactRepository .findByType (type );
168+ 
169+         SoftAssertions .assertSoftly (softly  -> {
170+             softly .assertThat (entities ).isNotNull ();
171+             softly .assertThat (entities ).allMatch (e  -> e .type ().equals (type ));
172+         });
173+ 
174+     }
139175
140176
141177
0 commit comments