Skip to content

Commit 06eb0db

Browse files
committed
test: add more assertions
1 parent e5881c3 commit 06eb0db

1 file changed

Lines changed: 80 additions & 6 deletions

File tree

src/it/java/io/weaviate/integration/ORMITest.java

Lines changed: 80 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414
import io.weaviate.ConcurrentTest;
1515
import io.weaviate.client6.v1.api.WeaviateClient;
1616
import io.weaviate.client6.v1.api.collections.CollectionConfig;
17-
import io.weaviate.client6.v1.api.collections.WeaviateObject;
1817
import io.weaviate.client6.v1.api.collections.annotations.Collection;
1918
import io.weaviate.client6.v1.api.collections.annotations.Property;
19+
import io.weaviate.client6.v1.api.collections.data.InsertManyResponse.InsertObject;
20+
import io.weaviate.client6.v1.api.collections.query.Where;
2021
import io.weaviate.containers.Container;
2122

2223
public class ORMITest extends ConcurrentTest {
@@ -224,12 +225,85 @@ public void test_insertAndQuery() throws Exception {
224225
var inserted = things.data.insert(thing);
225226

226227
// Assert
227-
var optional = things.query.byId(inserted.uuid());
228-
var got = Assertions.assertThat(optional).get()
229-
.extracting(WeaviateObject::properties).actual();
230-
231-
Assertions.assertThat(got)
228+
var got = things.query.byId(inserted.uuid());
229+
Assertions.assertThat(got).get()
232230
.usingRecursiveComparison(COMPARISON_CONFIG)
233231
.isEqualTo(thing);
234232
}
233+
234+
@Test
235+
public void test_insertManyAndQuery() throws Exception {
236+
short short_ = 666;
237+
int int_ = 666;
238+
long long_ = 666;
239+
float float_ = 666;
240+
double double_ = 666;
241+
boolean boolean_ = true;
242+
UUID uuid = UUID.randomUUID();
243+
OffsetDateTime date = OffsetDateTime.now();
244+
String text = "hello";
245+
246+
var thing = new Thing(
247+
text,
248+
new String[] { text },
249+
List.of(text),
250+
251+
OffsetDateTime.now(),
252+
new OffsetDateTime[] { date },
253+
List.of(date),
254+
255+
UUID.randomUUID(),
256+
new UUID[] { uuid },
257+
List.of(uuid),
258+
259+
short_,
260+
short_,
261+
new short[] { short_ },
262+
new Short[] { short_ },
263+
List.of(short_),
264+
265+
int_,
266+
int_,
267+
new int[] { int_ },
268+
new Integer[] { int_ },
269+
List.of(int_),
270+
271+
long_,
272+
long_,
273+
new long[] { long_ },
274+
new Long[] { long_ },
275+
List.of(long_),
276+
277+
float_,
278+
float_,
279+
new float[] { float_ },
280+
new Float[] { float_ },
281+
List.of(float_),
282+
283+
double_,
284+
double_,
285+
new double[] { double_ },
286+
new Double[] { double_ },
287+
List.of(double_),
288+
289+
boolean_,
290+
boolean_,
291+
new boolean[] { boolean_ },
292+
new Boolean[] { boolean_ },
293+
List.of(boolean_));
294+
295+
var things = client.collections.use(Thing.class);
296+
297+
// Act
298+
var inserted = things.data.insertMany(thing, thing, thing);
299+
300+
// Assert
301+
var uuids = inserted.responses().stream().map(InsertObject::uuid).toArray(String[]::new);
302+
var got = things.query.fetchObjects(q -> q.where(Where.uuid().containsAny(uuids)));
303+
Assertions.assertThat(got.objects())
304+
.hasSize(3)
305+
.usingRecursiveComparison(COMPARISON_CONFIG)
306+
.asInstanceOf(InstanceOfAssertFactories.list(Thing.class))
307+
.contains(thing, thing, thing);
308+
}
235309
}

0 commit comments

Comments
 (0)