Skip to content

Commit 74285d8

Browse files
BoxStore: assert exception on open twice, close on open after close.
1 parent 97d05f7 commit 74285d8

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

tests/objectbox-java-test/src/test/java/io/objectbox/BoxStoreTest.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,17 @@ private void assertThrowsStoreIsClosed(ThrowingRunnable runnable) {
150150
assertEquals("Store is closed", ex.getMessage());
151151
}
152152

153-
@Test(expected = DbException.class)
154-
public void testPreventTwoBoxStoresWithSameFileOpenend() {
155-
createBoxStore();
153+
@Test
154+
public void openSamePath_fails() {
155+
DbException ex = assertThrows(DbException.class, this::createBoxStore);
156+
assertTrue(ex.getMessage().contains("Another BoxStore is still open for this directory"));
156157
}
157158

158159
@Test
159-
public void testOpenSameBoxStoreAfterClose() {
160+
public void openSamePath_afterClose_works() {
160161
store.close();
161-
createBoxStore();
162+
BoxStore store2 = createBoxStore();
163+
store2.close();
162164
}
163165

164166
@Test

0 commit comments

Comments
 (0)