Skip to content

Commit e5881c3

Browse files
committed
test: add more assertions
1 parent 69476d6 commit e5881c3

1 file changed

Lines changed: 17 additions & 9 deletions

File tree

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

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import org.assertj.core.api.Assertions;
99
import org.assertj.core.api.InstanceOfAssertFactories;
10+
import org.assertj.core.api.recursive.comparison.RecursiveComparisonConfiguration;
1011
import org.junit.BeforeClass;
1112
import org.junit.Test;
1213

@@ -149,13 +150,20 @@ public void test_createCollection() throws Exception {
149150
Map.entry("booleanBoxedList", "boolean[]"));
150151
}
151152

153+
private final RecursiveComparisonConfiguration COMPARISON_CONFIG = RecursiveComparisonConfiguration.builder()
154+
// Assertj is having a really bad time comparing List<Float>,
155+
// so we'll just always return true here.
156+
.withComparatorForFields((a, b) -> 0, "floatBoxedList")
157+
.withComparatorForType((a, b) -> Double.compare(a.doubleValue(), b.doubleValue()), Number.class)
158+
.build();
159+
152160
@Test
153161
public void test_insertAndQuery() throws Exception {
154162
short short_ = 666;
155163
int int_ = 666;
156-
long long_ = 666L;
157-
float float_ = 666f;
158-
double double_ = 666d;
164+
long long_ = 666;
165+
float float_ = 666;
166+
double double_ = 666;
159167
boolean boolean_ = true;
160168
UUID uuid = UUID.randomUUID();
161169
OffsetDateTime date = OffsetDateTime.now();
@@ -216,12 +224,12 @@ public void test_insertAndQuery() throws Exception {
216224
var inserted = things.data.insert(thing);
217225

218226
// Assert
219-
var got = things.query.byId(inserted.uuid());
220-
Assertions.assertThat(got).get()
221-
.extracting(WeaviateObject::properties, InstanceOfAssertFactories.type(Thing.class));
227+
var optional = things.query.byId(inserted.uuid());
228+
var got = Assertions.assertThat(optional).get()
229+
.extracting(WeaviateObject::properties).actual();
222230

223-
// TODO: add assertions;
231+
Assertions.assertThat(got)
232+
.usingRecursiveComparison(COMPARISON_CONFIG)
233+
.isEqualTo(thing);
224234
}
225-
226-
// TODO: insertMany (batch)
227235
}

0 commit comments

Comments
 (0)