package com.wolfninja.keystore.redis;

import org.easymock.EasyMock;
import org.testng.Assert;
import org.testng.annotations.Test;

import redis.clients.jedis.JedisPool;

import com.wolfninja.keystore.api.Keyspace;

@SuppressWarnings("javadoc")
@Test
public class RedisAdapterTest {

	@Test
	public void create() {
		final JedisPool mockPool = EasyMock.createMock(JedisPool.class);

		final RedisAdapter actual = RedisAdapter.create(mockPool);

		Assert.assertNotNull(actual);
	}

	@Test
	public void getKeyspace() {
		final JedisPool mockPool = EasyMock.createMock(JedisPool.class);

		final RedisAdapter adapter = RedisAdapter.create(mockPool);
		final Keyspace actual = adapter.getKeyspace("my.keyspace");

		Assert.assertEquals(actual.getClass(), RedisKeyspace.class);
	}
}

@@ -32,16 +32,44 @@
 redis;%0A%0A
+import java.util.Optional;%0A%0A
 import o
@@ -150,51 +150,56 @@
 ons.
-Test;%0A%0Aimport redis.clients.jedis.JedisPool
+DataProvider;%0Aimport org.testng.annotations.Test
 ;%0A%0Ai
@@ -242,16 +242,55 @@
 space;%0A%0A
+import redis.clients.jedis.JedisPool;%0A%0A
 @Suppres
@@ -359,192 +359,1024 @@
 Test
-%0A%09public void create() %7B%0A%09%09final JedisPool mockPool = EasyMock.createMock(JedisPool.class);%0A%0A%09%09final RedisAdapter actual = RedisAdapter.create(mockPool);%0A%0A%09%09Assert.assertNotNull(actual
+(dataProvider = %22buildKeyspaceNameData%22)%0A%09public void buildKeyspaceName(final String inputPrefix, final String expected) %7B%0A%09%09final JedisPool mockPool = EasyMock.createMock(JedisPool.class);%0A%0A%09%09final RedisAdapter adapter = RedisAdapter.create(mockPool, inputPrefix);%0A%09%09final String actual = adapter.buildKeyspaceName(%22myKeyspace%22);%0A%09%09Assert.assertEquals(actual, expected);%0A%09%7D%0A%0A%09@DataProvider%0A%09Object%5B%5D%5B%5D buildKeyspaceNameData() %7B%0A%09%09return new Object%5B%5D%5B%5D %7B //%0A%09%09%09%09%7B null, %22myKeyspace%22 %7D, //%0A%09%09%09%09%7B %22nice_%22, %22nice_myKeyspace%22 %7D, //%0A%09%09%7D;%0A%09%7D%0A%0A%09@Test%0A%09public void create() %7B%0A%09%09final JedisPool mockPool = EasyMock.createMock(JedisPool.class);%0A%0A%09%09final RedisAdapter actual = RedisAdapter.create(mockPool);%0A%0A%09%09Assert.assertNotNull(actual);%0A%09%7D%0A%0A%09@Test%0A%09public void createWithPrefix() %7B%0A%09%09final JedisPool mockPool = EasyMock.createMock(JedisPool.class);%0A%0A%09%09final RedisAdapter actual = RedisAdapter.create(mockPool, %22asdf_%22);%0A%0A%09%09Assert.assertNotNull(actual);%0A%09%09Assert.assertEquals(actual.getKeyspacePrefix(), Optional.of(%22asdf_%22)
 );%0A%09

Add test coverage for prefix