objectbox-dart
objectbox-dart copied to clipboard
Testable and Immutability of ObjectBox
Request
Make ObjectBox object is suitable to unit tests
Override Equality of Condition and implementations of Condition
Thus following code can work
verify(() => mockBox.query(Entity_.id.equals(id))).called(1);
and use const constructor for ObjectBoxException
/// ObjectBox database exception.
class ObjectBoxException implements Exception {
/// Exception message.
final String message;
/// Create a new exception.
ObjectBoxException(this.message); // <--- add const
@override
String toString() => 'ObjectBoxException: $message';
}
This shoul be done, especially QueryBuilder contains private methods and cannot be mocked. So I can not write unit test for my repo classes because of QueryBuilder. This reduces coverage and blind spots. This issue opened 4 years ago.