File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
tests/objectbox-java-test/src/test/java/io/objectbox/query Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 4747import static io .objectbox .TestEntity_ .simpleLong ;
4848import static io .objectbox .TestEntity_ .simpleShort ;
4949import static io .objectbox .TestEntity_ .simpleString ;
50+ import static io .objectbox .TestEntity_ .simpleStringArray ;
5051import static org .junit .Assert .assertEquals ;
5152import static org .junit .Assert .assertFalse ;
5253import static org .junit .Assert .assertNotNull ;
@@ -243,6 +244,16 @@ public void testString() {
243244 assertEquals (2 , box .query ().contains (simpleString , "nana" ).build ().count ());
244245 }
245246
247+ @ Test
248+ public void testStringArray () {
249+ putTestEntitiesStrings ();
250+ // contains(prop, value) matches if value is equal to one of the array items.
251+ // Verify by not matching entity where 'banana' is only a substring of an array item ('banana milk shake').
252+ List <TestEntity > results = box .query ().contains (simpleStringArray , "banana" ).build ().find ();
253+ assertEquals (1 , results .size ());
254+ assertEquals ("banana" , results .get (0 ).getSimpleStringArray ()[0 ]);
255+ }
256+
246257 @ Test
247258 public void testStringLess () {
248259 putTestEntitiesStrings ();
You can’t perform that action at this time.
0 commit comments