Giter Club home page Giter Club logo

mock-jedis's Introduction

Mock Jedis

Mock Jedis is a library for mocking out Jedis clients. It's useful for testing your code without actually having a live redis server up. Currently, mock-jedis supports pipelining and all the basic Jedis commands, but if you find missing functionality you're welcome to submit a pull request.

Compile

with gradle (preferred method):

gradle build

Adding mock-jedis to your project

Add it as a dependency to your project.

Here's a sample gradle script that will pull mock-jedis 0.4.0 from maven-central

buildscript {
    repositories {
        mavenCentral()
    }
}

apply plugin: 'java'

dependencies {
  testCompile 'com.fiftyonred:mock-jedis:0.4.0'
}

Sample maven dependency definition:

<dependency>
    <groupId>com.fiftyonred</groupId>
    <artifactId>mock-jedis</artifactId>
    <version>0.4.0</version>
    <type>jar</type>
    <scope>test</scope>
</dependency>

Using mock-jedis

Jedis j = new MockJedis("test");
j.set("test", "123");
assertEquals("123", j.get("test"));

Supported Commands

Currently the following commands are supported by mock-jedis

  • KEYS: DEL DUMP EXISTS EXPIRE EXPIREAT KEYS PERSIST PEXPIRE PEXPIREAT PTTL RANDOMKEY RENAME RENAMENX RESTORE TTL TYPE
  • STRINGS: APPEND DECR DECRBY GET GETSET INCR INCRBY INCRBYFLOAT MGET MSET MSETNX PSETEX SET SETEX SETNX STRLEN
  • HASHES: HDEL HEXISTS HGET HGETALL HINCRBY HINCRBYFLOAT HKEYS HLEN HMGET HMSET HSET HSETNX HVALS
  • LISTS: LLEN LPOP LPUSH
  • SETS: SADD SCARD SDIFF SDIFFSTORE SINTER SINTERSTORE SISMEMBER SMEMBERS SMOVE SPOP SRANDMEMBER SREM SUNION SUNIONSTORE
  • CONNECTIONS: ECHO PING SELECT QUIT
  • SERVER: DBSIZE FLUSHALL FLUSHDB
  • PIPELINES

Unsupported Things

  • All commands not listed above

mock-jedis's People

Contributors

idyedov avatar kshchepanovskyi avatar fniwes avatar bittrance avatar bsideup avatar jitpack-io avatar vpranckaitis avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.