Skip to content

Commit 8868321

Browse files
QueryTest: test setParameters for int[] and long[] with notIn as well.
- Split testScalarNotIn test.
1 parent 75d1220 commit 8868321

File tree

1 file changed

+24
-3
lines changed
  • tests/objectbox-java-test/src/test/java/io/objectbox/query

1 file changed

+24
-3
lines changed

tests/objectbox-java-test/src/test/java/io/objectbox/query/QueryTest.java

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,16 +186,37 @@ public void testLongIn() {
186186
}
187187

188188
@Test
189-
public void testScalarNotIn() {
189+
public void testIntNotIn() {
190190
putTestEntitiesScalars();
191191

192192
int[] valuesInt = {1, 1, 2, 3, 2003, 2007, 2002, -1};
193-
Query<TestEntity> query = box.query().notIn(simpleInt, valuesInt).build();
193+
Query<TestEntity> query = box.query().notIn(simpleInt, valuesInt).parameterAlias("int").build();
194194
assertEquals(7, query.count());
195195

196+
int[] valuesInt2 = {2003};
197+
query.setParameters(simpleInt, valuesInt2);
198+
assertEquals(9, query.count());
199+
200+
int[] valuesInt3 = {2003, 2007};
201+
query.setParameters("int", valuesInt3);
202+
assertEquals(8, query.count());
203+
}
204+
205+
@Test
206+
public void testLongNotIn() {
207+
putTestEntitiesScalars();
208+
196209
long[] valuesLong = {1, 1, 2, 3, 3003, 3007, 3002, -1};
197-
query = box.query().notIn(simpleLong, valuesLong).build();
210+
Query<TestEntity> query = box.query().notIn(simpleLong, valuesLong).parameterAlias("long").build();
198211
assertEquals(7, query.count());
212+
213+
long[] valuesLong2 = {3003};
214+
query.setParameters(simpleLong, valuesLong2);
215+
assertEquals(9, query.count());
216+
217+
long[] valuesLong3 = {3003, 3007};
218+
query.setParameters("long", valuesLong3);
219+
assertEquals(8, query.count());
199220
}
200221

201222
@Test

0 commit comments

Comments
 (0)