diff --git a/src/test/java/com/github/fppt/jedismock/comparisontests/streams/XAddTests.java b/src/test/java/com/github/fppt/jedismock/comparisontests/streams/XAddTests.java index faacf29ff..6595b6825 100644 --- a/src/test/java/com/github/fppt/jedismock/comparisontests/streams/XAddTests.java +++ b/src/test/java/com/github/fppt/jedismock/comparisontests/streams/XAddTests.java @@ -6,14 +6,12 @@ import org.junit.jupiter.api.extension.ExtendWith; import redis.clients.jedis.Jedis; import redis.clients.jedis.StreamEntryID; +import redis.clients.jedis.exceptions.JedisDataException; import redis.clients.jedis.params.XAddParams; import java.util.Map; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.*; @ExtendWith(ComparisonBase.class) public class XAddTests { @@ -158,4 +156,13 @@ void whenNomkstream_ensureReturnsNull(Jedis jedis) { Map.of("a", "b") )); } + + @TestTemplate + void whenZeroId_ensureThrowsException(Jedis jedis) { + assertThrows( + JedisDataException.class, + () -> jedis.xadd("s", XAddParams.xAddParams().id("0"), Map.of("a", "b")), + "ERR The ID specified in XADD is equal or smaller than the target stream top item" + ); + } }