Skip to content

Commit

Permalink
Tests: useful exception assert fail messages
Browse files Browse the repository at this point in the history
  • Loading branch information
greenrobot-team committed May 7, 2024
1 parent 9cce634 commit 1942a50
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions objectbox_test/test/box_test.dart
Expand Up @@ -288,15 +288,15 @@ void main() {
() => store
.box<TestEntity2>()
.putQueued(TestEntity2(), mode: PutMode.update),
throwsA(predicate(
(ArgumentError e) => e.toString().contains('ID is not set'))));
throwsA(isA<ArgumentError>()
.having((e) => e.message, "message", contains("ID is not set"))));

expect(
() => store
.box<TestEntityNonRel>()
.putQueued(TestEntityNonRel.filled(id: 5), mode: PutMode.insert),
throwsA(predicate((ArgumentError e) =>
e.toString().contains('Use ID 0 (zero) to insert new entities'))));
throwsA(isA<ArgumentError>().having((e) => e.message, "message",
contains("Use ID 0 (zero) to insert new entities"))));

store.awaitQueueCompletion();
expect(store.box<TestEntity2>().count(), 0);
Expand Down

0 comments on commit 1942a50

Please sign in to comment.