Skip to content

Make RedisAccessor abstract #2645

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>3.2.0-SNAPSHOT</version>
<version>3.2.0-GH-2494-SNAPSHOT</version>

<name>Spring Data Redis</name>
<description>Spring Data module for Redis</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* @author John Blum
* @see org.springframework.beans.factory.InitializingBean
*/
public class RedisAccessor implements InitializingBean {
public abstract class RedisAccessor implements InitializingBean {

/** Logger available to subclasses */
protected final Log logger = LogFactory.getLog(getClass());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void setAndGetConnectionFactory() {

RedisConnectionFactory mockConnectionFactory = mock(RedisConnectionFactory.class);

RedisAccessor redisAccessor = new RedisAccessor();
RedisAccessor redisAccessor = new TestRedisAccessor();

assertThat(redisAccessor.getConnectionFactory()).isNull();

Expand All @@ -61,7 +61,7 @@ void setAndGetConnectionFactory() {
void getRequiredConnectionFactoryWhenNull() {

assertThatIllegalStateException()
.isThrownBy(() -> new RedisAccessor().getRequiredConnectionFactory())
.isThrownBy(() -> new TestRedisAccessor().getRequiredConnectionFactory())
.withMessage("RedisConnectionFactory is required")
.withNoCause();
}
Expand All @@ -71,7 +71,7 @@ void afterPropertiesSetCallsGetRequiredConnectionFactory() {

RedisConnectionFactory mockConnectionFactory = mock(RedisConnectionFactory.class);

RedisAccessor redisAccessor = spy(new RedisAccessor());
RedisAccessor redisAccessor = spy(new TestRedisAccessor());

doReturn(mockConnectionFactory).when(redisAccessor).getRequiredConnectionFactory();

Expand All @@ -81,4 +81,7 @@ void afterPropertiesSetCallsGetRequiredConnectionFactory() {
verify(redisAccessor, times(1)).getRequiredConnectionFactory();
verifyNoMoreInteractions(redisAccessor);
}

static class TestRedisAccessor extends RedisAccessor { }

}