GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — CursorTest: assert put with invalid ID error message. · Hancony/objectbox-java@8bd4a79

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • tests/objectbox-java-test/src/test/java/io/objectbox
    • CursorTest.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎tests/objectbox-java-test/src/test/java/io/objectbox/CursorTest.java‎

Copy file name to clipboardExpand all lines: tests/objectbox-java-test/src/test/java/io/objectbox/CursorTest.java
+7-2Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,20 @@ public void testPutAndGetEntity() {
4949
transaction.abort();
5050
}
5151

52-
@Test(expected = IllegalArgumentException.class)
52+
@Test
5353
public void testPutEntityWithInvalidId() {
5454
TestEntity entity = new TestEntity();
5555
entity.setId(777);
5656
Transaction transaction = store.beginTx();
5757
Cursor<TestEntity> cursor = transaction.createCursor(TestEntity.class);
58+
5859
try {
59-
cursor.put(entity);
60+
IllegalArgumentException ex = assertThrows(IllegalArgumentException.class,
61+
() -> cursor.put(entity));
62+
assertEquals(ex.getMessage(), "ID is higher or equal to internal ID sequence: 777 (vs. 1)." +
63+
" Use ID 0 (zero) to insert new entities.");
6064
} finally {
65+
// Always clean up, even if assertions fail, to avoid misleading clean-up errors.
6166
cursor.close();
6267
transaction.close();
6368
}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.