Skip to content

An in-memory implementation of Redis in Java. (Forked to add bugfixes etc.)

License

Notifications You must be signed in to change notification settings

StreetContxt/redis-mock-java

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

redis-mock-java

Redis mock, adapted from Rarefied Redis's redis-mock-java project.

Background

This fork was created to add features and bugfixes to the original Rarefied Redis mock project, which is more comprehensive than other Redis mocks but hasn't been updated in some time.

Building locally

This project uses a standard Maven build.

mvn compile - compile mvn test - run tests mvn package - publish local snapshot

Publishing

CircleCI is set up to publish commits with a release-<version number> tag to the SCX Bintray maven repo.

Adding dependency

To use this in another project, the SCX maven Bintray repo must be added as a repository in that project's build file.

E.g. in an sbt build, add the bintray repo: resolvers += Resolver.bintrayRepo("streetcontxt", "maven") ...then add the library dependency: "com.streetcontxt" % "redis-mock-java" % "1.0"

Usage

In addition to the functionality of the original project (redis-mock-java), this fork adds a Mockito-based wrapper for the mocked Jedis object which will throw an informative error if you try to invoke a method that hasn't been mocked, rather than calling the superclass method and causing a more subtle error. (There are so many Jedis methods and no interface, so it's otherwise difficult to ensure full implementation of a mock.) It can be used as follows:

import com.streetcontxt.redis_mock.adapter.jedis.CheckedJedisMock;
import redis.clients.jedis.Jedis;
[...]
Jedis mockJedis = new CheckedJedisMock().getJedisMock();

About

An in-memory implementation of Redis in Java. (Forked to add bugfixes etc.)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 99.8%
  • Other 0.2%