@Test public void sscanCount() { ScanParams params = new ScanParams(); params.count(2); jedis.sadd("foo", "a1", "a2", "a3", "a4", "a5"); ScanResult<String> result = jedis.sscan("foo", SCAN_POINTER_START, params); assertFalse(result.getResult().isEmpty()); // binary params = new ScanParams(); params.count(2); jedis.sadd(bfoo, bbar1, bbar2, bbar3); ScanResult<byte[]> bResult = jedis.sscan(bfoo, SCAN_POINTER_START_BINARY, params); assertFalse(bResult.getResult().isEmpty()); }
@Test public void sscan() { jedis.sadd("foo", "a", "b"); ScanResult<String> result = jedis.sscan("foo", SCAN_POINTER_START); assertEquals(SCAN_POINTER_START, result.getCursor()); assertFalse(result.getResult().isEmpty()); // binary jedis.sadd(bfoo, ba, bb); ScanResult<byte[]> bResult = jedis.sscan(bfoo, SCAN_POINTER_START_BINARY); assertArrayEquals(SCAN_POINTER_START_BINARY, bResult.getCursorAsBytes()); assertFalse(bResult.getResult().isEmpty()); }
@Test public void sscanMatch() { ScanParams params = new ScanParams(); params.match("a*"); jedis.sadd("foo", "b", "a", "aa"); ScanResult<String> result = jedis.sscan("foo", SCAN_POINTER_START, params); assertEquals(SCAN_POINTER_START, result.getCursor()); assertFalse(result.getResult().isEmpty()); // binary params = new ScanParams(); params.match(bbarstar); jedis.sadd(bfoo, bbar1, bbar2, bbar3); ScanResult<byte[]> bResult = jedis.sscan(bfoo, SCAN_POINTER_START_BINARY, params); assertArrayEquals(SCAN_POINTER_START_BINARY, bResult.getCursorAsBytes()); assertFalse(bResult.getResult().isEmpty()); }