From e7a201aab384200b2847d0e2397d5ecc92381774 Mon Sep 17 00:00:00 2001 From: Andrea Cavalli Date: Fri, 20 Sep 2024 13:05:05 +0200 Subject: [PATCH] Fix tests --- .../core/impl/test/EmbeddedDBTest.java | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/test/java/it/cavallium/rockserver/core/impl/test/EmbeddedDBTest.java b/src/test/java/it/cavallium/rockserver/core/impl/test/EmbeddedDBTest.java index c2743dc..b0cefa4 100644 --- a/src/test/java/it/cavallium/rockserver/core/impl/test/EmbeddedDBTest.java +++ b/src/test/java/it/cavallium/rockserver/core/impl/test/EmbeddedDBTest.java @@ -162,11 +162,29 @@ abstract class EmbeddedDBTest { Assertions.assertThrows(RocksDBException.class, () -> db.put(arena, 0, colId, key, toMemorySegmentSimple(arena, 123), RequestType.delta())); } else { Assertions.assertThrows(RocksDBException.class, () -> db.put(arena, 0, colId, key, MemorySegment.NULL, RequestType.delta())); - Assertions.assertThrows(IllegalArgumentException.class, () -> db.put(arena, 0, colId, key, null, RequestType.delta())); + Assertions.assertThrows(RocksDBException.class, () -> { + try { + db.put(arena, 0, colId, key, null, RequestType.delta()); + } catch (IllegalArgumentException ex) { + throw RocksDBException.of(RocksDBException.RocksDBErrorType.UNEXPECTED_NULL_VALUE, ex); + } + }); } - Assertions.assertThrows(IllegalArgumentException.class, () -> db.put(arena, 0, colId, null, value1, RequestType.delta())); - Assertions.assertThrows(IllegalArgumentException.class, () -> db.put(arena, 0, colId, null, null, RequestType.delta())); + Assertions.assertThrows(RocksDBException.class, () -> { + try { + db.put(arena, 0, colId, null, value1, RequestType.delta()); + } catch (IllegalArgumentException ex) { + throw RocksDBException.of(RocksDBException.RocksDBErrorType.UNEXPECTED_NULL_VALUE, ex); + } + }); + Assertions.assertThrows(RocksDBException.class, () -> { + try { + db.put(arena, 0, colId, null, null, RequestType.delta()); + } catch (IllegalArgumentException ex) { + throw RocksDBException.of(RocksDBException.RocksDBErrorType.UNEXPECTED_NULL_VALUE, ex); + } + }); Assertions.assertThrows(RocksDBException.class, () -> db.put(arena, 0, colId, key, value1, null)); Assertions.assertThrows(RocksDBException.class, () -> db.put(arena, 1, colId, key, value1, RequestType.delta())); Assertions.assertThrows(RocksDBException.class, () -> db.put(arena, 0, 21203, key, value1, RequestType.delta()));