We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f6b5423 commit f69d08dCopy full SHA for f69d08d
tests/objectbox-java-test/src/test/java/io/objectbox/CursorTest.java
@@ -267,12 +267,12 @@ public void testThrowInEntityConstructor() {
267
268
Transaction transaction = store.beginReadTx();
269
Cursor<TestEntity> cursor = transaction.createCursor(TestEntity.class);
270
- try {
271
- cursor.get(1);
272
- fail("Should have thrown");
273
- } catch (RuntimeException e) {
274
- assertEquals(TestEntity.EXCEPTION_IN_CONSTRUCTOR_MESSAGE, e.getMessage());
275
- }
+
+ RuntimeException exception = assertThrows(
+ RuntimeException.class,
+ () -> cursor.get(1)
+ );
+ assertEquals(TestEntity.EXCEPTION_IN_CONSTRUCTOR_MESSAGE, exception.getMessage());
276
277
cursor.close();
278
transaction.close();
0 commit comments