Skip to content

Commit d4af51e

Browse files
committed
DATAREDIS-531 - Polishing.
Use quit method for close verification in tests. Refine static imports. Fix spelling. Original pull request: #218.
1 parent 58d23de commit d4af51e

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionUnitTestSuite.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ public void scanShouldKeepTheConnectionOpen() {
225225

226226
connection.scan();
227227

228-
verify(jedisSpy, never()).close();
228+
verify(jedisSpy, never()).quit();
229229
}
230230

231231
/**
@@ -254,7 +254,7 @@ public void sScanShouldKeepTheConnectionOpen() {
254254

255255
connection.sScan("foo".getBytes(), ScanOptions.NONE);
256256

257-
verify(jedisSpy, never()).close();
257+
verify(jedisSpy, never()).quit();
258258
}
259259

260260
/**
@@ -283,7 +283,7 @@ public void zScanShouldKeepTheConnectionOpen() {
283283

284284
connection.zScan("foo".getBytes(), ScanOptions.NONE);
285285

286-
verify(jedisSpy, never()).close();
286+
verify(jedisSpy, never()).quit();
287287
}
288288

289289
/**
@@ -312,7 +312,7 @@ public void hScanShouldKeepTheConnectionOpen() {
312312

313313
connection.hScan("foo".getBytes(), ScanOptions.NONE);
314314

315-
verify(jedisSpy, never()).close();
315+
verify(jedisSpy, never()).quit();
316316
}
317317

318318
/**
@@ -467,6 +467,5 @@ public MockedClientJedis(String host, Client client) {
467467
super(host);
468468
this.client = client;
469469
}
470-
471470
}
472471
}

src/test/java/org/springframework/data/redis/core/RedisTemplateUnitTests.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717

1818
import static org.hamcrest.core.Is.*;
1919
import static org.hamcrest.core.IsNull.*;
20+
import static org.hamcrest.core.IsSame.*;
2021
import static org.junit.Assert.*;
2122
import static org.mockito.Matchers.*;
2223
import static org.mockito.Mockito.*;
2324

2425
import java.io.Serializable;
2526

26-
import org.hamcrest.core.IsSame;
2727
import org.junit.Before;
2828
import org.junit.Test;
2929
import org.junit.runner.RunWith;
@@ -89,7 +89,7 @@ public void templateShouldPassOnAndUseResoureLoaderClassLoaderToDefaultJdkSerial
8989
template.afterPropertiesSet();
9090

9191
when(redisConnectionMock.get(any(byte[].class)))
92-
.thenReturn(new JdkSerializationRedisSerializer().serialize(new SomeArbitrarySeriaizableObject()));
92+
.thenReturn(new JdkSerializationRedisSerializer().serialize(new SomeArbitrarySerializableObject()));
9393

9494
Object deserialized = template.opsForValue().get("spring");
9595
assertThat(deserialized, notNullValue());
@@ -105,11 +105,11 @@ public void executeWithStickyConnectionShouldNotCloseConnectionWhenDone() {
105105
CapturingCallback callback = new CapturingCallback();
106106
template.executeWithStickyConnection(callback);
107107

108-
assertThat(callback.getConnection(), IsSame.sameInstance(redisConnectionMock));
108+
assertThat(callback.getConnection(), sameInstance(redisConnectionMock));
109109
verify(redisConnectionMock, never()).close();
110110
}
111111

112-
static class SomeArbitrarySeriaizableObject implements Serializable {
112+
static class SomeArbitrarySerializableObject implements Serializable {
113113
private static final long serialVersionUID = -5973659324040506423L;
114114
}
115115

@@ -126,7 +126,5 @@ public Cursor<Object> doInRedis(RedisConnection connection) throws DataAccessExc
126126
public RedisConnection getConnection() {
127127
return connection;
128128
}
129-
130129
}
131-
132130
}

0 commit comments

Comments
 (0)