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 47
47
import static io .objectbox .TestEntity_ .simpleLong ;
48
48
import static io .objectbox .TestEntity_ .simpleShort ;
49
49
import static io .objectbox .TestEntity_ .simpleString ;
50
+ import static io .objectbox .TestEntity_ .simpleStringArray ;
50
51
import static org .junit .Assert .assertEquals ;
51
52
import static org .junit .Assert .assertFalse ;
52
53
import static org .junit .Assert .assertNotNull ;
@@ -243,6 +244,16 @@ public void testString() {
243
244
assertEquals (2 , box .query ().contains (simpleString , "nana" ).build ().count ());
244
245
}
245
246
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
+
246
257
@ Test
247
258
public void testStringLess () {
248
259
putTestEntitiesStrings ();
You can’t perform that action at this time.
0 commit comments