diff --git a/etc/checkstyle/checkstyle.xml b/etc/checkstyle/checkstyle.xml
index 97024516..fba2b17f 100644
--- a/etc/checkstyle/checkstyle.xml
+++ b/etc/checkstyle/checkstyle.xml
@@ -2,11 +2,36 @@
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/etc/checkstyle/suppressions.xml b/etc/checkstyle/suppressions.xml
index 6c039443..f893c50f 100644
--- a/etc/checkstyle/suppressions.xml
+++ b/etc/checkstyle/suppressions.xml
@@ -2,16 +2,10 @@
-
-
-
-
-
-
diff --git a/spring-session-core/src/test/java/org/springframework/session/MapSessionTests.java b/spring-session-core/src/test/java/org/springframework/session/MapSessionTests.java
index c016a74b..b2aee29b 100644
--- a/spring-session-core/src/test/java/org/springframework/session/MapSessionTests.java
+++ b/spring-session-core/src/test/java/org/springframework/session/MapSessionTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2018 the original author or authors.
+ * Copyright 2014-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,7 +24,7 @@ import org.junit.Before;
import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
+import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
public class MapSessionTests {
@@ -38,7 +38,7 @@ public class MapSessionTests {
@Test
public void constructorNullSession() {
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(() -> new MapSession((Session) null))
.withMessage("session cannot be null");
}
@@ -70,7 +70,7 @@ public class MapSessionTests {
@Test
public void getRequiredAttributeWhenNullThenException() {
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(() -> this.session.getRequiredAttribute("attrName"))
.withMessage("Required attribute 'attrName' is missing.");
}
diff --git a/spring-session-core/src/test/java/org/springframework/session/ReactiveMapSessionRepositoryTests.java b/spring-session-core/src/test/java/org/springframework/session/ReactiveMapSessionRepositoryTests.java
index defdf7ea..b542546b 100644
--- a/spring-session-core/src/test/java/org/springframework/session/ReactiveMapSessionRepositoryTests.java
+++ b/spring-session-core/src/test/java/org/springframework/session/ReactiveMapSessionRepositoryTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2018 the original author or authors.
+ * Copyright 2014-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,7 +27,7 @@ import org.junit.Before;
import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
+import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
/**
* Tests for {@link ReactiveMapSessionRepository}.
@@ -60,7 +60,7 @@ public class ReactiveMapSessionRepositoryTests {
@Test
public void constructorMapWhenNullThenThrowsIllegalArgumentException() {
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(() -> new ReactiveMapSessionRepository(null))
.withMessage("sessions cannot be null");
}
@@ -107,13 +107,12 @@ public class ReactiveMapSessionRepositoryTests {
public void createSessionWhenCustomMaxInactiveIntervalThenCustomMaxInactiveInterval() {
final Duration expectedMaxInterval = new MapSession().getMaxInactiveInterval()
.plusSeconds(10);
- this.repository.setDefaultMaxInactiveInterval(
- (int) expectedMaxInterval.getSeconds());
+ this.repository
+ .setDefaultMaxInactiveInterval((int) expectedMaxInterval.getSeconds());
Session session = this.repository.createSession().block();
- assertThat(session.getMaxInactiveInterval())
- .isEqualTo(expectedMaxInterval);
+ assertThat(session.getMaxInactiveInterval()).isEqualTo(expectedMaxInterval);
}
@Test
diff --git a/spring-session-core/src/test/java/org/springframework/session/security/web/authentication/SpringSessionRememberMeServicesTests.java b/spring-session-core/src/test/java/org/springframework/session/security/web/authentication/SpringSessionRememberMeServicesTests.java
index 3700fb76..8b480828 100644
--- a/spring-session-core/src/test/java/org/springframework/session/security/web/authentication/SpringSessionRememberMeServicesTests.java
+++ b/spring-session-core/src/test/java/org/springframework/session/security/web/authentication/SpringSessionRememberMeServicesTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2018 the original author or authors.
+ * Copyright 2014-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,7 +27,7 @@ import org.springframework.security.web.context.HttpSessionSecurityContextReposi
import org.springframework.test.util.ReflectionTestUtils;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
+import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
@@ -68,7 +68,7 @@ public class SpringSessionRememberMeServicesTests {
@Test
public void createWithNullParameter() {
this.rememberMeServices = new SpringSessionRememberMeServices();
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(
() -> this.rememberMeServices.setRememberMeParameterName(null))
.withMessage("rememberMeParameterName cannot be empty or null");
diff --git a/spring-session-core/src/test/java/org/springframework/session/web/http/DefaultCookieSerializerTests.java b/spring-session-core/src/test/java/org/springframework/session/web/http/DefaultCookieSerializerTests.java
index 38ac4636..4eac9dab 100644
--- a/spring-session-core/src/test/java/org/springframework/session/web/http/DefaultCookieSerializerTests.java
+++ b/spring-session-core/src/test/java/org/springframework/session/web/http/DefaultCookieSerializerTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2018 the original author or authors.
+ * Copyright 2014-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,7 +33,8 @@ import org.springframework.session.web.http.CookieSerializer.CookieValue;
import org.springframework.util.StringUtils;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
+import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
+import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
/**
* Tests for {@link DefaultCookieSerializer}.
@@ -214,7 +215,7 @@ public class DefaultCookieSerializerTests {
@Test
public void setDomainNameAndDomainNamePatternThrows() {
this.serializer.setDomainName("example.com");
- assertThatExceptionOfType(IllegalStateException.class)
+ assertThatIllegalStateException()
.isThrownBy(() -> this.serializer.setDomainNamePattern(".*"))
.withMessage("Cannot set both domainName and domainNamePattern");
}
@@ -248,7 +249,7 @@ public class DefaultCookieSerializerTests {
@Test
public void setDomainNamePatternAndDomainNameThrows() {
this.serializer.setDomainNamePattern(".*");
- assertThatExceptionOfType(IllegalStateException.class)
+ assertThatIllegalStateException()
.isThrownBy(() -> this.serializer.setDomainName("example.com"))
.withMessage("Cannot set both domainName and domainNamePattern");
}
@@ -274,7 +275,7 @@ public class DefaultCookieSerializerTests {
@Test
public void setCookieNameNullThrows() {
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(() -> this.serializer.setCookieName(null))
.withMessage("cookieName cannot be null");
}
diff --git a/spring-session-core/src/test/java/org/springframework/session/web/http/HeaderHttpSessionIdResolverTests.java b/spring-session-core/src/test/java/org/springframework/session/web/http/HeaderHttpSessionIdResolverTests.java
index 50124333..01114b16 100644
--- a/spring-session-core/src/test/java/org/springframework/session/web/http/HeaderHttpSessionIdResolverTests.java
+++ b/spring-session-core/src/test/java/org/springframework/session/web/http/HeaderHttpSessionIdResolverTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2018 the original author or authors.
+ * Copyright 2014-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,7 +27,7 @@ import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.test.util.ReflectionTestUtils;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
+import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
/**
* Tests for {@link HeaderHttpSessionIdResolver}.
@@ -74,7 +74,7 @@ public class HeaderHttpSessionIdResolverTests {
@Test
public void createResolverWithNullHeaderName() {
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(() -> new HeaderHttpSessionIdResolver(null))
.withMessage("headerName cannot be null");
}
diff --git a/spring-session-core/src/test/java/org/springframework/session/web/http/SessionRepositoryFilterTests.java b/spring-session-core/src/test/java/org/springframework/session/web/http/SessionRepositoryFilterTests.java
index 27148988..0b40dbde 100644
--- a/spring-session-core/src/test/java/org/springframework/session/web/http/SessionRepositoryFilterTests.java
+++ b/spring-session-core/src/test/java/org/springframework/session/web/http/SessionRepositoryFilterTests.java
@@ -62,6 +62,7 @@ import org.springframework.test.util.ReflectionTestUtils;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
+import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.assertj.core.api.Assertions.fail;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
@@ -1408,7 +1409,7 @@ public class SessionRepositoryFilterTests {
@Test
public void setHttpSessionIdResolverNull() {
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(() -> this.filter.setHttpSessionIdResolver(null))
.withMessage("httpSessionIdResolver cannot be null");
}
diff --git a/spring-session-core/src/test/java/org/springframework/session/web/server/session/SpringSessionWebSessionStoreTests.java b/spring-session-core/src/test/java/org/springframework/session/web/server/session/SpringSessionWebSessionStoreTests.java
index dbe54c2f..c39bc420 100644
--- a/spring-session-core/src/test/java/org/springframework/session/web/server/session/SpringSessionWebSessionStoreTests.java
+++ b/spring-session-core/src/test/java/org/springframework/session/web/server/session/SpringSessionWebSessionStoreTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2018 the original author or authors.
+ * Copyright 2014-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,7 +33,7 @@ import org.springframework.session.Session;
import org.springframework.web.server.WebSession;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
+import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.verify;
@@ -69,15 +69,14 @@ public class SpringSessionWebSessionStoreTests {
@Test
public void constructorWhenNullRepositoryThenThrowsIllegalArgumentException() {
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(() -> new SpringSessionWebSessionStore(null))
.withMessage("reactiveSessionRepository cannot be null");
}
@Test
public void createSessionWhenNoAttributesThenNotStarted() {
- WebSession createdWebSession = this.webSessionStore.createWebSession()
- .block();
+ WebSession createdWebSession = this.webSessionStore.createWebSession().block();
assertThat(createdWebSession.isStarted()).isFalse();
}
@@ -86,16 +85,14 @@ public class SpringSessionWebSessionStoreTests {
public void createSessionWhenAddAttributeThenStarted() {
given(this.createSession.getAttributeNames())
.willReturn(Collections.singleton("a"));
- WebSession createdWebSession = this.webSessionStore.createWebSession()
- .block();
+ WebSession createdWebSession = this.webSessionStore.createWebSession().block();
assertThat(createdWebSession.isStarted()).isTrue();
}
@Test
public void createSessionWhenGetAttributesAndSizeThenDelegatesToCreateSession() {
- WebSession createdWebSession = this.webSessionStore.createWebSession()
- .block();
+ WebSession createdWebSession = this.webSessionStore.createWebSession().block();
Map attributes = createdWebSession.getAttributes();
@@ -109,8 +106,7 @@ public class SpringSessionWebSessionStoreTests {
@Test
public void createSessionWhenGetAttributesAndIsEmptyThenDelegatesToCreateSession() {
- WebSession createdWebSession = this.webSessionStore.createWebSession()
- .block();
+ WebSession createdWebSession = this.webSessionStore.createWebSession().block();
Map attributes = createdWebSession.getAttributes();
@@ -124,8 +120,7 @@ public class SpringSessionWebSessionStoreTests {
@Test
public void createSessionWhenGetAttributesAndContainsKeyAndNotStringThenFalse() {
- WebSession createdWebSession = this.webSessionStore.createWebSession()
- .block();
+ WebSession createdWebSession = this.webSessionStore.createWebSession().block();
Map attributes = createdWebSession.getAttributes();
@@ -134,8 +129,7 @@ public class SpringSessionWebSessionStoreTests {
@Test
public void createSessionWhenGetAttributesAndContainsKeyAndNotFoundThenFalse() {
- WebSession createdWebSession = this.webSessionStore.createWebSession()
- .block();
+ WebSession createdWebSession = this.webSessionStore.createWebSession().block();
Map attributes = createdWebSession.getAttributes();
@@ -146,8 +140,7 @@ public class SpringSessionWebSessionStoreTests {
public void createSessionWhenGetAttributesAndContainsKeyAndFoundThenTrue() {
given(this.createSession.getAttributeNames())
.willReturn(Collections.singleton("a"));
- WebSession createdWebSession = this.webSessionStore.createWebSession()
- .block();
+ WebSession createdWebSession = this.webSessionStore.createWebSession().block();
Map attributes = createdWebSession.getAttributes();
@@ -156,8 +149,7 @@ public class SpringSessionWebSessionStoreTests {
@Test
public void createSessionWhenGetAttributesAndPutThenDelegatesToCreateSession() {
- WebSession createdWebSession = this.webSessionStore.createWebSession()
- .block();
+ WebSession createdWebSession = this.webSessionStore.createWebSession().block();
Map attributes = createdWebSession.getAttributes();
attributes.put("a", "b");
@@ -167,8 +159,7 @@ public class SpringSessionWebSessionStoreTests {
@Test
public void createSessionWhenGetAttributesAndPutNullThenDelegatesToCreateSession() {
- WebSession createdWebSession = this.webSessionStore.createWebSession()
- .block();
+ WebSession createdWebSession = this.webSessionStore.createWebSession().block();
Map attributes = createdWebSession.getAttributes();
attributes.put("a", null);
@@ -178,8 +169,7 @@ public class SpringSessionWebSessionStoreTests {
@Test
public void createSessionWhenGetAttributesAndRemoveThenDelegatesToCreateSession() {
- WebSession createdWebSession = this.webSessionStore.createWebSession()
- .block();
+ WebSession createdWebSession = this.webSessionStore.createWebSession().block();
Map attributes = createdWebSession.getAttributes();
attributes.remove("a");
@@ -189,8 +179,7 @@ public class SpringSessionWebSessionStoreTests {
@Test
public void createSessionWhenGetAttributesAndPutAllThenDelegatesToCreateSession() {
- WebSession createdWebSession = this.webSessionStore.createWebSession()
- .block();
+ WebSession createdWebSession = this.webSessionStore.createWebSession().block();
Map attributes = createdWebSession.getAttributes();
attributes.putAll(Collections.singletonMap("a", "b"));
@@ -202,8 +191,7 @@ public class SpringSessionWebSessionStoreTests {
public void createSessionWhenGetAttributesAndClearThenDelegatesToCreateSession() {
given(this.createSession.getAttributeNames())
.willReturn(Collections.singleton("a"));
- WebSession createdWebSession = this.webSessionStore.createWebSession()
- .block();
+ WebSession createdWebSession = this.webSessionStore.createWebSession().block();
Map attributes = createdWebSession.getAttributes();
attributes.clear();
@@ -215,8 +203,7 @@ public class SpringSessionWebSessionStoreTests {
public void createSessionWhenGetAttributesAndKeySetThenDelegatesToCreateSession() {
given(this.createSession.getAttributeNames())
.willReturn(Collections.singleton("a"));
- WebSession createdWebSession = this.webSessionStore.createWebSession()
- .block();
+ WebSession createdWebSession = this.webSessionStore.createWebSession().block();
Map attributes = createdWebSession.getAttributes();
@@ -228,8 +215,7 @@ public class SpringSessionWebSessionStoreTests {
given(this.createSession.getAttributeNames())
.willReturn(Collections.singleton("a"));
given(this.createSession.getAttribute("a")).willReturn("b");
- WebSession createdWebSession = this.webSessionStore.createWebSession()
- .block();
+ WebSession createdWebSession = this.webSessionStore.createWebSession().block();
Map attributes = createdWebSession.getAttributes();
@@ -243,8 +229,7 @@ public class SpringSessionWebSessionStoreTests {
.willReturn(Collections.singleton(attrName));
String attrValue = "attrValue";
given(this.createSession.getAttribute(attrName)).willReturn(attrValue);
- WebSession createdWebSession = this.webSessionStore.createWebSession()
- .block();
+ WebSession createdWebSession = this.webSessionStore.createWebSession().block();
Map attributes = createdWebSession.getAttributes();
Set> entries = attributes.entrySet();
@@ -256,8 +241,7 @@ public class SpringSessionWebSessionStoreTests {
@Test
public void retrieveSessionThenStarted() {
String id = "id";
- WebSession retrievedWebSession = this.webSessionStore
- .retrieveSession(id).block();
+ WebSession retrievedWebSession = this.webSessionStore.retrieveSession(id).block();
assertThat(retrievedWebSession.isStarted()).isTrue();
verify(this.findByIdSession).setLastAccessedTime(any());
@@ -275,7 +259,7 @@ public class SpringSessionWebSessionStoreTests {
@Test
public void setClockWhenNullThenException() {
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(() -> this.webSessionStore.setClock(null))
.withMessage("clock cannot be null");
}
diff --git a/spring-session-core/src/test/java/org/springframework/session/web/socket/handler/WebSocketConnectHandlerDecoratorFactoryTests.java b/spring-session-core/src/test/java/org/springframework/session/web/socket/handler/WebSocketConnectHandlerDecoratorFactoryTests.java
index 8a2f0df0..1243cc14 100644
--- a/spring-session-core/src/test/java/org/springframework/session/web/socket/handler/WebSocketConnectHandlerDecoratorFactoryTests.java
+++ b/spring-session-core/src/test/java/org/springframework/session/web/socket/handler/WebSocketConnectHandlerDecoratorFactoryTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2018 the original author or authors.
+ * Copyright 2014-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,7 +31,7 @@ import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.WebSocketSession;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
+import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.mockito.BDDMockito.willThrow;
import static org.mockito.Mockito.any;
import static org.mockito.Mockito.verify;
@@ -56,7 +56,7 @@ public class WebSocketConnectHandlerDecoratorFactoryTests {
@Test
public void constructorNullEventPublisher() {
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(() -> new WebSocketConnectHandlerDecoratorFactory(null))
.withMessage("eventPublisher cannot be null");
}
diff --git a/spring-session-core/src/test/java/org/springframework/session/web/socket/server/SessionRepositoryMessageInterceptorTests.java b/spring-session-core/src/test/java/org/springframework/session/web/socket/server/SessionRepositoryMessageInterceptorTests.java
index f833e752..dd6ddbbc 100644
--- a/spring-session-core/src/test/java/org/springframework/session/web/socket/server/SessionRepositoryMessageInterceptorTests.java
+++ b/spring-session-core/src/test/java/org/springframework/session/web/socket/server/SessionRepositoryMessageInterceptorTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2018 the original author or authors.
+ * Copyright 2014-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,7 +43,7 @@ import org.springframework.session.Session;
import org.springframework.session.SessionRepository;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
+import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.argThat;
@@ -82,7 +82,7 @@ public class SessionRepositoryMessageInterceptorTests {
@Test
public void preSendconstructorNullRepository() {
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(() -> new SessionRepositoryMessageInterceptor<>(null))
.withMessage("sessionRepository cannot be null");
}
@@ -134,14 +134,14 @@ public class SessionRepositoryMessageInterceptorTests {
@Test
public void setMatchingMessageTypesNull() {
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(() -> this.interceptor.setMatchingMessageTypes(null))
.withMessage("matchingMessageTypes cannot be null or empty");
}
@Test
public void setMatchingMessageTypesEmpty() {
- assertThatExceptionOfType(IllegalArgumentException.class).isThrownBy(
+ assertThatIllegalArgumentException().isThrownBy(
() -> this.interceptor.setMatchingMessageTypes(Collections.emptySet()))
.withMessage("matchingMessageTypes cannot be null or empty");
}
diff --git a/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/ReactiveRedisOperationsSessionRepositoryITests.java b/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/ReactiveRedisOperationsSessionRepositoryITests.java
index 5cd1cb34..c439740f 100644
--- a/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/ReactiveRedisOperationsSessionRepositoryITests.java
+++ b/spring-session-data-redis/src/integration-test/java/org/springframework/session/data/redis/ReactiveRedisOperationsSessionRepositoryITests.java
@@ -31,7 +31,7 @@ import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
+import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
/**
* Integration tests for {@link ReactiveRedisOperationsSessionRepository}.
@@ -223,7 +223,7 @@ public class ReactiveRedisOperationsSessionRepositoryITests extends AbstractRedi
toSave.setLastAccessedTime(Instant.now());
- assertThatExceptionOfType(IllegalStateException.class)
+ assertThatIllegalStateException()
.isThrownBy(() -> this.repository.save(toSave).block())
.withMessage("Session was invalidated");
diff --git a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/ReactiveRedisOperationsSessionRepositoryTests.java b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/ReactiveRedisOperationsSessionRepositoryTests.java
index 21f1f937..ad43eb83 100644
--- a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/ReactiveRedisOperationsSessionRepositoryTests.java
+++ b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/ReactiveRedisOperationsSessionRepositoryTests.java
@@ -36,7 +36,7 @@ import org.springframework.session.data.redis.ReactiveRedisOperationsSessionRepo
import org.springframework.test.util.ReflectionTestUtils;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
+import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.BDDMockito.given;
@@ -80,7 +80,7 @@ public class ReactiveRedisOperationsSessionRepositoryTests {
@Test
public void constructorWithNullReactiveRedisOperations() {
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(() -> new ReactiveRedisOperationsSessionRepository(null))
.withMessageContaining("sessionRedisOperations cannot be null");
}
@@ -95,14 +95,14 @@ public class ReactiveRedisOperationsSessionRepositoryTests {
@Test
public void nullRedisKeyNamespace() {
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(() -> this.repository.setRedisKeyNamespace(null))
.withMessage("namespace cannot be null or empty");
}
@Test
public void emptyRedisKeyNamespace() {
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(() -> this.repository.setRedisKeyNamespace(""))
.withMessage("namespace cannot be null or empty");
}
@@ -125,7 +125,7 @@ public class ReactiveRedisOperationsSessionRepositoryTests {
@Test
public void nullRedisFlushMode() {
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(() -> this.repository.setRedisFlushMode(null))
.withMessage("redisFlushMode cannot be null");
}
diff --git a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/RedisOperationsSessionRepositoryTests.java b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/RedisOperationsSessionRepositoryTests.java
index 17d66190..bec69ea0 100644
--- a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/RedisOperationsSessionRepositoryTests.java
+++ b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/RedisOperationsSessionRepositoryTests.java
@@ -59,7 +59,7 @@ import org.springframework.session.data.redis.RedisOperationsSessionRepository.R
import org.springframework.session.events.AbstractSessionEvent;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
+import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.ArgumentMatchers.anyString;
@@ -115,7 +115,7 @@ public class RedisOperationsSessionRepositoryTests {
@Test
public void setApplicationEventPublisherNull() {
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(() -> this.redisRepository.setApplicationEventPublisher(null))
.withMessage("applicationEventPublisher cannot be null");
}
@@ -195,7 +195,9 @@ public class RedisOperationsSessionRepositoryTests {
.get(RedisOperationsSessionRepository.CREATION_TIME_ATTR);
assertThat(creationTime).isEqualTo(session.getCreationTime().toEpochMilli());
assertThat(delta.get(RedisOperationsSessionRepository.MAX_INACTIVE_ATTR))
- .isEqualTo((int) Duration.ofSeconds(MapSession.DEFAULT_MAX_INACTIVE_INTERVAL_SECONDS).getSeconds());
+ .isEqualTo((int) Duration
+ .ofSeconds(MapSession.DEFAULT_MAX_INACTIVE_INTERVAL_SECONDS)
+ .getSeconds());
assertThat(delta.get(RedisOperationsSessionRepository.LAST_ACCESSED_ATTR))
.isEqualTo(session.getCreationTime().toEpochMilli());
}
@@ -485,9 +487,12 @@ public class RedisOperationsSessionRepositoryTests {
.willReturn(Collections.singleton(sessionId));
given(this.redisOperations.boundHashOps(getKey(sessionId)))
.willReturn(this.boundHashOperations);
- Map map = map(RedisOperationsSessionRepository.CREATION_TIME_ATTR, createdTime.toEpochMilli(),
- RedisOperationsSessionRepository.MAX_INACTIVE_ATTR, (int) maxInactive.getSeconds(),
- RedisOperationsSessionRepository.LAST_ACCESSED_ATTR, lastAccessed.toEpochMilli());
+ Map map = map(RedisOperationsSessionRepository.CREATION_TIME_ATTR,
+ createdTime.toEpochMilli(),
+ RedisOperationsSessionRepository.MAX_INACTIVE_ATTR,
+ (int) maxInactive.getSeconds(),
+ RedisOperationsSessionRepository.LAST_ACCESSED_ATTR,
+ lastAccessed.toEpochMilli());
given(this.boundHashOperations.entries()).willReturn(map);
Map sessionIdToSessions = this.redisRepository
@@ -753,7 +758,9 @@ public class RedisOperationsSessionRepositoryTests {
.get(RedisOperationsSessionRepository.CREATION_TIME_ATTR);
assertThat(creationTime).isEqualTo(session.getCreationTime().toEpochMilli());
assertThat(delta.get(RedisOperationsSessionRepository.MAX_INACTIVE_ATTR))
- .isEqualTo((int) Duration.ofSeconds(MapSession.DEFAULT_MAX_INACTIVE_INTERVAL_SECONDS).getSeconds());
+ .isEqualTo((int) Duration
+ .ofSeconds(MapSession.DEFAULT_MAX_INACTIVE_INTERVAL_SECONDS)
+ .getSeconds());
assertThat(delta.get(RedisOperationsSessionRepository.LAST_ACCESSED_ATTR))
.isEqualTo(session.getCreationTime().toEpochMilli());
}
@@ -859,7 +866,7 @@ public class RedisOperationsSessionRepositoryTests {
@Test
public void setRedisFlushModeNull() {
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(() -> this.redisRepository.setRedisFlushMode(null))
.withMessage("redisFlushMode cannot be null");
}
@@ -886,14 +893,14 @@ public class RedisOperationsSessionRepositoryTests {
@Test
public void setRedisKeyNamespaceNullNamespace() {
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(() -> this.redisRepository.setRedisKeyNamespace(null))
.withMessage("namespace cannot be null or empty");
}
@Test
public void setRedisKeyNamespaceEmptyNamespace() {
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(() -> this.redisRepository.setRedisKeyNamespace(" "))
.withMessage("namespace cannot be null or empty");
}
diff --git a/spring-session-hazelcast/src/test/java/org/springframework/session/hazelcast/HazelcastSessionRepositoryTests.java b/spring-session-hazelcast/src/test/java/org/springframework/session/hazelcast/HazelcastSessionRepositoryTests.java
index 27f8e795..43221bed 100644
--- a/spring-session-hazelcast/src/test/java/org/springframework/session/hazelcast/HazelcastSessionRepositoryTests.java
+++ b/spring-session-hazelcast/src/test/java/org/springframework/session/hazelcast/HazelcastSessionRepositoryTests.java
@@ -39,7 +39,7 @@ import org.springframework.session.MapSession;
import org.springframework.session.hazelcast.HazelcastSessionRepository.HazelcastSession;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
+import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyLong;
@@ -79,7 +79,7 @@ public class HazelcastSessionRepositoryTests {
@Test
public void constructorNullHazelcastInstance() {
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(() -> new HazelcastSessionRepository(null))
.withMessage("HazelcastInstance must not be null");
}
@@ -262,8 +262,8 @@ public class HazelcastSessionRepositoryTests {
HazelcastSession session = this.repository.createSession();
String sessionId = session.getId();
session.setMaxInactiveInterval(Duration.ofSeconds(1));
- verify(this.sessions, times(1)).set(eq(sessionId),
- eq(session.getDelegate()), isA(Long.class), eq(TimeUnit.SECONDS));
+ verify(this.sessions, times(1)).set(eq(sessionId), eq(session.getDelegate()),
+ isA(Long.class), eq(TimeUnit.SECONDS));
verify(this.sessions).setTtl(eq(sessionId), anyLong(), any());
verify(this.sessions, times(1)).executeOnKey(eq(sessionId),
any(EntryProcessor.class));
diff --git a/spring-session-jdbc/src/test/java/org/springframework/session/jdbc/JdbcOperationsSessionRepositoryTests.java b/spring-session-jdbc/src/test/java/org/springframework/session/jdbc/JdbcOperationsSessionRepositoryTests.java
index 81a3c875..5b7cc5f5 100644
--- a/spring-session-jdbc/src/test/java/org/springframework/session/jdbc/JdbcOperationsSessionRepositoryTests.java
+++ b/spring-session-jdbc/src/test/java/org/springframework/session/jdbc/JdbcOperationsSessionRepositoryTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2018 the original author or authors.
+ * Copyright 2014-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,7 +41,7 @@ import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionDefinition;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
+import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.ArgumentMatchers.anyString;
@@ -69,144 +69,146 @@ public class JdbcOperationsSessionRepositoryTests {
private JdbcOperations jdbcOperations = mock(JdbcOperations.class);
- private PlatformTransactionManager transactionManager = mock(PlatformTransactionManager.class);
+ private PlatformTransactionManager transactionManager = mock(
+ PlatformTransactionManager.class);
private JdbcOperationsSessionRepository repository;
@Before
public void setUp() {
- this.repository = new JdbcOperationsSessionRepository(this.jdbcOperations, this.transactionManager);
+ this.repository = new JdbcOperationsSessionRepository(this.jdbcOperations,
+ this.transactionManager);
}
@Test
public void constructorNullJdbcOperations() {
- assertThatExceptionOfType(IllegalArgumentException.class).isThrownBy(
+ assertThatIllegalArgumentException().isThrownBy(
() -> new JdbcOperationsSessionRepository(null, this.transactionManager))
.withMessage("JdbcOperations must not be null");
}
@Test
public void constructorNullTransactionManager() {
- assertThatExceptionOfType(IllegalArgumentException.class).isThrownBy(
+ assertThatIllegalArgumentException().isThrownBy(
() -> new JdbcOperationsSessionRepository(this.jdbcOperations, null))
.withMessage("TransactionManager must not be null");
}
@Test
public void setTableNameNull() {
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(() -> this.repository.setTableName(null))
.withMessage("Table name must not be empty");
}
@Test
public void setTableNameEmpty() {
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(() -> this.repository.setTableName(" "))
.withMessage("Table name must not be empty");
}
@Test
public void setCreateSessionQueryNull() {
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(() -> this.repository.setCreateSessionQuery(null))
.withMessage("Query must not be empty");
}
@Test
public void setCreateSessionQueryEmpty() {
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(() -> this.repository.setCreateSessionQuery(" "))
.withMessage("Query must not be empty");
}
@Test
public void setCreateSessionAttributeQueryNull() {
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(() -> this.repository.setCreateSessionAttributeQuery(null))
.withMessage("Query must not be empty");
}
@Test
public void setCreateSessionAttributeQueryEmpty() {
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(() -> this.repository.setCreateSessionAttributeQuery(" "))
.withMessage("Query must not be empty");
}
@Test
public void setGetSessionQueryNull() {
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(() -> this.repository.setGetSessionQuery(null))
.withMessage("Query must not be empty");
}
@Test
public void setGetSessionQueryEmpty() {
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(() -> this.repository.setGetSessionQuery(" "))
.withMessage("Query must not be empty");
}
@Test
public void setUpdateSessionQueryNull() {
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(() -> this.repository.setUpdateSessionQuery(null))
.withMessage("Query must not be empty");
}
@Test
public void setUpdateSessionQueryEmpty() {
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(() -> this.repository.setUpdateSessionQuery(" "))
.withMessage("Query must not be empty");
}
@Test
public void setUpdateSessionAttributeQueryNull() {
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(() -> this.repository.setUpdateSessionAttributeQuery(null))
.withMessage("Query must not be empty");
}
@Test
public void setUpdateSessionAttributeQueryEmpty() {
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(() -> this.repository.setUpdateSessionAttributeQuery(" "))
.withMessage("Query must not be empty");
}
@Test
public void setDeleteSessionAttributeQueryNull() {
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(() -> this.repository.setDeleteSessionAttributeQuery(null))
.withMessage("Query must not be empty");
}
@Test
public void setDeleteSessionAttributeQueryEmpty() {
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(() -> this.repository.setDeleteSessionAttributeQuery(" "))
.withMessage("Query must not be empty");
}
@Test
public void setDeleteSessionQueryNull() {
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(() -> this.repository.setDeleteSessionQuery(null))
.withMessage("Query must not be empty");
}
@Test
public void setDeleteSessionQueryEmpty() {
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(() -> this.repository.setDeleteSessionQuery(" "))
.withMessage("Query must not be empty");
}
@Test
public void setListSessionsByPrincipalNameQueryNull() {
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(
() -> this.repository.setListSessionsByPrincipalNameQuery(null))
.withMessage("Query must not be empty");
@@ -214,7 +216,7 @@ public class JdbcOperationsSessionRepositoryTests {
@Test
public void setListSessionsByPrincipalNameQueryEmpty() {
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(
() -> this.repository.setListSessionsByPrincipalNameQuery(" "))
.withMessage("Query must not be empty");
@@ -222,7 +224,7 @@ public class JdbcOperationsSessionRepositoryTests {
@Test
public void setDeleteSessionsByLastAccessTimeQueryNull() {
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(
() -> this.repository.setDeleteSessionsByExpiryTimeQuery(null))
.withMessage("Query must not be empty");
@@ -230,21 +232,21 @@ public class JdbcOperationsSessionRepositoryTests {
@Test
public void setDeleteSessionsByLastAccessTimeQueryEmpty() {
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(() -> this.repository.setDeleteSessionsByExpiryTimeQuery(" "))
.withMessage("Query must not be empty");
}
@Test
public void setLobHandlerNull() {
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(() -> this.repository.setLobHandler(null))
.withMessage("LobHandler must not be null");
}
@Test
public void setConversionServiceNull() {
- assertThatExceptionOfType(IllegalArgumentException.class)
+ assertThatIllegalArgumentException()
.isThrownBy(() -> this.repository.setConversionService(null))
.withMessage("conversionService must not be null");
}
@@ -269,7 +271,8 @@ public class JdbcOperationsSessionRepositoryTests {
.createSession();
assertThat(session.isNew()).isTrue();
- assertThat(session.getMaxInactiveInterval()).isEqualTo(Duration.ofSeconds(interval));
+ assertThat(session.getMaxInactiveInterval())
+ .isEqualTo(Duration.ofSeconds(interval));
verifyZeroInteractions(this.jdbcOperations);
}
@@ -328,8 +331,8 @@ public class JdbcOperationsSessionRepositoryTests {
@Test
public void saveUpdatedAddSingleAttribute() {
- JdbcOperationsSessionRepository.JdbcSession session = this.repository.new JdbcSession("primaryKey",
- new MapSession());
+ JdbcOperationsSessionRepository.JdbcSession session = this.repository.new JdbcSession(
+ "primaryKey", new MapSession());
session.setAttribute("testName", "testValue");
this.repository.save(session);
@@ -344,8 +347,8 @@ public class JdbcOperationsSessionRepositoryTests {
@Test
public void saveUpdatedAddMultipleAttributes() {
- JdbcOperationsSessionRepository.JdbcSession session = this.repository.new JdbcSession("primaryKey",
- new MapSession());
+ JdbcOperationsSessionRepository.JdbcSession session = this.repository.new JdbcSession(
+ "primaryKey", new MapSession());
session.setAttribute("testName1", "testValue1");
session.setAttribute("testName2", "testValue2");
@@ -361,8 +364,8 @@ public class JdbcOperationsSessionRepositoryTests {
@Test
public void saveUpdatedModifySingleAttribute() {
- JdbcOperationsSessionRepository.JdbcSession session = this.repository.new JdbcSession("primaryKey",
- new MapSession());
+ JdbcOperationsSessionRepository.JdbcSession session = this.repository.new JdbcSession(
+ "primaryKey", new MapSession());
session.setAttribute("testName", "testValue");
session.clearChangeFlags();
session.setAttribute("testName", "testValue");
@@ -379,8 +382,8 @@ public class JdbcOperationsSessionRepositoryTests {
@Test
public void saveUpdatedModifyMultipleAttributes() {
- JdbcOperationsSessionRepository.JdbcSession session = this.repository.new JdbcSession("primaryKey",
- new MapSession());
+ JdbcOperationsSessionRepository.JdbcSession session = this.repository.new JdbcSession(
+ "primaryKey", new MapSession());
session.setAttribute("testName1", "testValue1");
session.setAttribute("testName2", "testValue2");
session.clearChangeFlags();
@@ -399,8 +402,8 @@ public class JdbcOperationsSessionRepositoryTests {
@Test
public void saveUpdatedRemoveSingleAttribute() {
- JdbcOperationsSessionRepository.JdbcSession session = this.repository.new JdbcSession("primaryKey",
- new MapSession());
+ JdbcOperationsSessionRepository.JdbcSession session = this.repository.new JdbcSession(
+ "primaryKey", new MapSession());
session.setAttribute("testName", "testValue");
session.clearChangeFlags();
session.removeAttribute("testName");
@@ -417,8 +420,8 @@ public class JdbcOperationsSessionRepositoryTests {
@Test
public void saveUpdatedRemoveNonExistingAttribute() {
- JdbcOperationsSessionRepository.JdbcSession session = this.repository.new JdbcSession("primaryKey",
- new MapSession());
+ JdbcOperationsSessionRepository.JdbcSession session = this.repository.new JdbcSession(
+ "primaryKey", new MapSession());
session.removeAttribute("testName");
this.repository.save(session);
@@ -430,8 +433,8 @@ public class JdbcOperationsSessionRepositoryTests {
@Test
public void saveUpdatedRemoveMultipleAttributes() {
- JdbcOperationsSessionRepository.JdbcSession session = this.repository.new JdbcSession("primaryKey",
- new MapSession());
+ JdbcOperationsSessionRepository.JdbcSession session = this.repository.new JdbcSession(
+ "primaryKey", new MapSession());
session.setAttribute("testName1", "testValue1");
session.setAttribute("testName2", "testValue2");
session.clearChangeFlags();
@@ -450,8 +453,8 @@ public class JdbcOperationsSessionRepositoryTests {
@Test // gh-1070
public void saveUpdatedAddAndModifyAttribute() {
- JdbcOperationsSessionRepository.JdbcSession session = this.repository.new JdbcSession("primaryKey",
- new MapSession());
+ JdbcOperationsSessionRepository.JdbcSession session = this.repository.new JdbcSession(
+ "primaryKey", new MapSession());
session.setAttribute("testName", "testValue1");
session.setAttribute("testName", "testValue2");
@@ -467,8 +470,8 @@ public class JdbcOperationsSessionRepositoryTests {
@Test // gh-1070
public void saveUpdatedAddAndRemoveAttribute() {
- JdbcOperationsSessionRepository.JdbcSession session = this.repository.new JdbcSession("primaryKey",
- new MapSession());
+ JdbcOperationsSessionRepository.JdbcSession session = this.repository.new JdbcSession(
+ "primaryKey", new MapSession());
session.setAttribute("testName", "testValue");
session.removeAttribute("testName");
@@ -481,8 +484,8 @@ public class JdbcOperationsSessionRepositoryTests {
@Test // gh-1070
public void saveUpdatedModifyAndRemoveAttribute() {
- JdbcOperationsSessionRepository.JdbcSession session = this.repository.new JdbcSession("primaryKey",
- new MapSession());
+ JdbcOperationsSessionRepository.JdbcSession session = this.repository.new JdbcSession(
+ "primaryKey", new MapSession());
session.setAttribute("testName", "testValue1");
session.clearChangeFlags();
session.setAttribute("testName", "testValue2");
@@ -500,8 +503,8 @@ public class JdbcOperationsSessionRepositoryTests {
@Test // gh-1070
public void saveUpdatedRemoveAndAddAttribute() {
- JdbcOperationsSessionRepository.JdbcSession session = this.repository.new JdbcSession("primaryKey",
- new MapSession());
+ JdbcOperationsSessionRepository.JdbcSession session = this.repository.new JdbcSession(
+ "primaryKey", new MapSession());
session.setAttribute("testName", "testValue1");
session.clearChangeFlags();
session.removeAttribute("testName");
@@ -519,8 +522,8 @@ public class JdbcOperationsSessionRepositoryTests {
@Test
public void saveUpdatedLastAccessedTime() {
- JdbcOperationsSessionRepository.JdbcSession session = this.repository.new JdbcSession("primaryKey",
- new MapSession());
+ JdbcOperationsSessionRepository.JdbcSession session = this.repository.new JdbcSession(
+ "primaryKey", new MapSession());
session.setLastAccessedTime(Instant.now());
this.repository.save(session);
@@ -535,8 +538,8 @@ public class JdbcOperationsSessionRepositoryTests {
@Test
public void saveUnchanged() {
- JdbcOperationsSessionRepository.JdbcSession session = this.repository.new JdbcSession("primaryKey",
- new MapSession());
+ JdbcOperationsSessionRepository.JdbcSession session = this.repository.new JdbcSession(
+ "primaryKey", new MapSession());
this.repository.save(session);
@@ -550,7 +553,7 @@ public class JdbcOperationsSessionRepositoryTests {
String sessionId = "testSessionId";
given(this.jdbcOperations.query(isA(String.class),
isA(PreparedStatementSetter.class), isA(ResultSetExtractor.class)))
- .willReturn(Collections.emptyList());
+ .willReturn(Collections.emptyList());
JdbcOperationsSessionRepository.JdbcSession session = this.repository
.findById(sessionId);
@@ -565,11 +568,11 @@ public class JdbcOperationsSessionRepositoryTests {
@SuppressWarnings("unchecked")
public void getSessionExpired() {
Session expired = this.repository.new JdbcSession();
- expired.setLastAccessedTime(Instant.now().minusSeconds(
- MapSession.DEFAULT_MAX_INACTIVE_INTERVAL_SECONDS + 1));
+ expired.setLastAccessedTime(Instant.now()
+ .minusSeconds(MapSession.DEFAULT_MAX_INACTIVE_INTERVAL_SECONDS + 1));
given(this.jdbcOperations.query(isA(String.class),
isA(PreparedStatementSetter.class), isA(ResultSetExtractor.class)))
- .willReturn(Collections.singletonList(expired));
+ .willReturn(Collections.singletonList(expired));
JdbcOperationsSessionRepository.JdbcSession session = this.repository
.findById(expired.getId());
@@ -589,7 +592,7 @@ public class JdbcOperationsSessionRepositoryTests {
saved.setAttribute("savedName", "savedValue");
given(this.jdbcOperations.query(isA(String.class),
isA(PreparedStatementSetter.class), isA(ResultSetExtractor.class)))
- .willReturn(Collections.singletonList(saved));
+ .willReturn(Collections.singletonList(saved));
JdbcOperationsSessionRepository.JdbcSession session = this.repository
.findById(saved.getId());
@@ -629,7 +632,7 @@ public class JdbcOperationsSessionRepositoryTests {
String principal = "username";
given(this.jdbcOperations.query(isA(String.class),
isA(PreparedStatementSetter.class), isA(ResultSetExtractor.class)))
- .willReturn(Collections.emptyList());
+ .willReturn(Collections.emptyList());
Map sessions = this.repository
.findByIndexNameAndIndexValue(
@@ -657,7 +660,7 @@ public class JdbcOperationsSessionRepositoryTests {
saved.add(saved2);
given(this.jdbcOperations.query(isA(String.class),
isA(PreparedStatementSetter.class), isA(ResultSetExtractor.class)))
- .willReturn(saved);
+ .willReturn(saved);
Map sessions = this.repository
.findByIndexNameAndIndexValue(
@@ -680,7 +683,8 @@ public class JdbcOperationsSessionRepositoryTests {
@Test // gh-1120
public void getAttributeNamesAndRemove() {
- JdbcOperationsSessionRepository.JdbcSession session = this.repository.createSession();
+ JdbcOperationsSessionRepository.JdbcSession session = this.repository
+ .createSession();
session.setAttribute("attribute1", "value1");
session.setAttribute("attribute2", "value2");
@@ -775,8 +779,8 @@ public class JdbcOperationsSessionRepositoryTests {
}
private void assertPropagationRequiresNew() {
- ArgumentCaptor argument =
- ArgumentCaptor.forClass(TransactionDefinition.class);
+ ArgumentCaptor argument = ArgumentCaptor
+ .forClass(TransactionDefinition.class);
verify(this.transactionManager, atLeastOnce()).getTransaction(argument.capture());
assertThat(argument.getValue().getPropagationBehavior())
.isEqualTo(TransactionDefinition.PROPAGATION_REQUIRES_NEW);