Skip to content

Commit 2eb73e4

Browse files
PropertyQueryTest: update not supported messages.
1 parent 5d009a5 commit 2eb73e4

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

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

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -465,28 +465,28 @@ private void assertUnsupported(Runnable runnable, String exceptionMessage) {
465465
@Test
466466
public void avg_notSupported() {
467467
Query<TestEntity> query = box.query().build();
468-
String exceptionMessage = "Property does not allow avg";
469-
assertUnsupported(() -> query.property(simpleBoolean).avg(), exceptionMessage);
468+
String exceptionMessage = "Cannot calculate sum. This function is for integer types only. This operation is not supported for Property ";
470469
assertUnsupported(() -> query.property(simpleByteArray).avg(), exceptionMessage);
471470
assertUnsupported(() -> query.property(simpleString).avg(), exceptionMessage);
472471
}
473472

474473
@Test
475474
public void min_notSupported() {
476475
Query<TestEntity> query = box.query().build();
477-
String exceptionMessage = "Property does not allow max"; // Note: currently JNI returns wrong error message.
476+
String exceptionMessage = "This operation is not supported for Property ";
478477
assertUnsupported(() -> query.property(simpleBoolean).min(), exceptionMessage);
479478
assertUnsupported(() -> query.property(simpleByteArray).min(), exceptionMessage);
480479
assertUnsupported(() -> query.property(simpleString).min(), exceptionMessage);
481480

482-
assertUnsupported(() -> query.property(simpleFloat).min(), exceptionMessage);
483-
assertUnsupported(() -> query.property(simpleDouble).min(), exceptionMessage);
481+
String exceptionMessage2 = "Use double based min (e.g. `minDouble()`) instead. This operation is not supported for Property ";
482+
assertUnsupported(() -> query.property(simpleFloat).min(), exceptionMessage2);
483+
assertUnsupported(() -> query.property(simpleDouble).min(), exceptionMessage2);
484484
}
485485

486486
@Test
487487
public void minDouble_notSupported() {
488488
Query<TestEntity> query = box.query().build();
489-
String exceptionMessage = "Property does not allow min (double)";
489+
String exceptionMessage = "Not a floating point type. This operation is not supported for Property ";
490490
assertUnsupported(() -> query.property(simpleBoolean).minDouble(), exceptionMessage);
491491
assertUnsupported(() -> query.property(simpleByteArray).minDouble(), exceptionMessage);
492492
assertUnsupported(() -> query.property(simpleString).minDouble(), exceptionMessage);
@@ -500,19 +500,20 @@ public void minDouble_notSupported() {
500500
@Test
501501
public void max_notSupported() {
502502
Query<TestEntity> query = box.query().build();
503-
String exceptionMessage = "Property does not allow max";
503+
String exceptionMessage = "This operation is not supported for Property ";
504504
assertUnsupported(() -> query.property(simpleBoolean).max(), exceptionMessage);
505505
assertUnsupported(() -> query.property(simpleByteArray).max(), exceptionMessage);
506506
assertUnsupported(() -> query.property(simpleString).max(), exceptionMessage);
507507

508-
assertUnsupported(() -> query.property(simpleFloat).max(), exceptionMessage);
509-
assertUnsupported(() -> query.property(simpleDouble).max(), exceptionMessage);
508+
String exceptionMessage2 = "Use double based max (e.g. `maxDouble()`) instead. This operation is not supported for Property ";
509+
assertUnsupported(() -> query.property(simpleFloat).max(), exceptionMessage2);
510+
assertUnsupported(() -> query.property(simpleDouble).max(), exceptionMessage2);
510511
}
511512

512513
@Test
513514
public void maxDouble_notSupported() {
514515
Query<TestEntity> query = box.query().build();
515-
String exceptionMessage = "Property does not allow max (double)";
516+
String exceptionMessage = "Not a floating point type. This operation is not supported for Property ";
516517
assertUnsupported(() -> query.property(simpleBoolean).maxDouble(), exceptionMessage);
517518
assertUnsupported(() -> query.property(simpleByteArray).maxDouble(), exceptionMessage);
518519
assertUnsupported(() -> query.property(simpleString).maxDouble(), exceptionMessage);
@@ -526,11 +527,11 @@ public void maxDouble_notSupported() {
526527
@Test
527528
public void sum_notSupported() {
528529
Query<TestEntity> query = box.query().build();
529-
String exceptionMessage = "Property does not allow sum";
530+
String exceptionMessage = "Cannot calculate sum. This function is for integer types only. This operation is not supported for Property ";
530531
assertUnsupported(() -> query.property(simpleByteArray).sum(), exceptionMessage);
531532
assertUnsupported(() -> query.property(simpleString).sum(), exceptionMessage);
532533

533-
String exceptionMessage2 = "Please use double based sum (e.g. `sumDouble()`) instead for property";
534+
String exceptionMessage2 = "Please use the double based sum instead. This operation is not supported for Property ";
534535
assertUnsupported(() -> query.property(simpleFloat).sum(), exceptionMessage2);
535536
assertUnsupported(() -> query.property(simpleDouble).sum(), exceptionMessage2);
536537
}

0 commit comments

Comments
 (0)