package benjamin.groehbiel.ch;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import static org.junit.Assert.assertNotNull;

@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = ApplicationTest.class)
public class JedisTest {

    @Autowired
    private JedisConnectionFactory jedisConnectionFactory;

    @Autowired
    private StringRedisTemplate redisTemplate;

    @Test
    public void testJedisConnectionFactory() {
        assertNotNull(jedisConnectionFactory);
    }

    @Test
    public void testRedisTemplate() {
        assertNotNull(redisTemplate);
    }

}

@@ -25,16 +25,65 @@
 el.ch;%0A%0A
+import org.junit.After;%0Aimport org.junit.Assert;%0A
 import o
@@ -97,16 +97,16 @@
 t.Test;%0A
-
 import o
@@ -478,16 +478,114 @@
 unner;%0A%0A
+import static org.hamcrest.MatcherAssert.assertThat;%0Aimport static org.hamcrest.Matchers.equalTo;%0A
 import s
@@ -892,16 +892,135 @@
 plate;%0A%0A
+    @After%0A    public void tearDown() %7B%0A        redisTemplate.getConnectionFactory().getConnection().flushDb();%0A    %7D%0A%0A
     @Tes
@@ -1166,24 +1166,24 @@
 emplate() %7B%0A
-
         asse
@@ -1215,10 +1215,395 @@
 %0A    %7D%0A%0A
+    @Test%0A    public void addEntry() %7B%0A        Long index = redisTemplate.opsForList().rightPush(%22ben%22, %22grohbiel%22);%0A        assertThat(index, equalTo(1L));%0A    %7D%0A%0A    @Test%0A    public void getEntry() %7B%0A        redisTemplate.opsForList().rightPush(%22ben%22, %22grohbiel%22);%0A        String s = redisTemplate.opsForValue().get(%22ben%22);%0A        Assert.assertThat(s, equalTo(%22grohbiel%22));%0A    %7D%0A%0A
 %7D%0A

Set and get a redis key-value pair.