Remove unnecessary throws declaration

This commit is contained in:
Vedran Pavic
2019-07-02 19:21:07 +02:00
parent 0731e7f2d0
commit 1ca9daccb4
26 changed files with 91 additions and 114 deletions

View File

@@ -47,7 +47,7 @@ class ReactiveRedisOperationsSessionRepositoryITests extends AbstractRedisITests
private ReactiveRedisOperationsSessionRepository repository;
@Test
void saves() throws InterruptedException {
void saves() {
ReactiveRedisOperationsSessionRepository.RedisSession toSave = this.repository.createSession().block();
String expectedAttributeName = "a";
@@ -100,7 +100,7 @@ class ReactiveRedisOperationsSessionRepositoryITests extends AbstractRedisITests
}
@Test
void changeSessionIdWhenOnlyChangeId() throws Exception {
void changeSessionIdWhenOnlyChangeId() {
String attrName = "changeSessionId";
String attrValue = "changeSessionId-value";
ReactiveRedisOperationsSessionRepository.RedisSession toSave = this.repository.createSession().block();
@@ -127,7 +127,7 @@ class ReactiveRedisOperationsSessionRepositoryITests extends AbstractRedisITests
}
@Test
void changeSessionIdWhenChangeTwice() throws Exception {
void changeSessionIdWhenChangeTwice() {
ReactiveRedisOperationsSessionRepository.RedisSession toSave = this.repository.createSession().block();
this.repository.save(toSave).block();
@@ -144,7 +144,7 @@ class ReactiveRedisOperationsSessionRepositoryITests extends AbstractRedisITests
}
@Test
void changeSessionIdWhenSetAttributeOnChangedSession() throws Exception {
void changeSessionIdWhenSetAttributeOnChangedSession() {
String attrName = "changeSessionId";
String attrValue = "changeSessionId-value";
@@ -171,7 +171,7 @@ class ReactiveRedisOperationsSessionRepositoryITests extends AbstractRedisITests
}
@Test
void changeSessionIdWhenHasNotSaved() throws Exception {
void changeSessionIdWhenHasNotSaved() {
ReactiveRedisOperationsSessionRepository.RedisSession toSave = this.repository.createSession().block();
String originalId = toSave.getId();
toSave.changeSessionId();

View File

@@ -173,7 +173,7 @@ class RedisOperationsSessionRepositoryITests extends AbstractRedisITests {
}
@Test
void findByPrincipalNameExpireRemovesIndex() throws Exception {
void findByPrincipalNameExpireRemovesIndex() {
String principalName = "findByPrincipalNameExpireRemovesIndex" + UUID.randomUUID();
RedisSession toSave = this.repository.createSession();
toSave.setAttribute(INDEX_NAME, principalName);
@@ -195,7 +195,7 @@ class RedisOperationsSessionRepositoryITests extends AbstractRedisITests {
}
@Test
void findByPrincipalNameNoPrincipalNameChange() throws Exception {
void findByPrincipalNameNoPrincipalNameChange() {
String principalName = "findByPrincipalNameNoPrincipalNameChange" + UUID.randomUUID();
RedisSession toSave = this.repository.createSession();
toSave.setAttribute(INDEX_NAME, principalName);
@@ -213,7 +213,7 @@ class RedisOperationsSessionRepositoryITests extends AbstractRedisITests {
}
@Test
void findByPrincipalNameNoPrincipalNameChangeReload() throws Exception {
void findByPrincipalNameNoPrincipalNameChangeReload() {
String principalName = "findByPrincipalNameNoPrincipalNameChangeReload" + UUID.randomUUID();
RedisSession toSave = this.repository.createSession();
toSave.setAttribute(INDEX_NAME, principalName);
@@ -233,7 +233,7 @@ class RedisOperationsSessionRepositoryITests extends AbstractRedisITests {
}
@Test
void findByDeletedPrincipalName() throws Exception {
void findByDeletedPrincipalName() {
String principalName = "findByDeletedPrincipalName" + UUID.randomUUID();
RedisSession toSave = this.repository.createSession();
toSave.setAttribute(INDEX_NAME, principalName);
@@ -250,7 +250,7 @@ class RedisOperationsSessionRepositoryITests extends AbstractRedisITests {
}
@Test
void findByChangedPrincipalName() throws Exception {
void findByChangedPrincipalName() {
String principalName = "findByChangedPrincipalName" + UUID.randomUUID();
String principalNameChanged = "findByChangedPrincipalName" + UUID.randomUUID();
RedisSession toSave = this.repository.createSession();
@@ -272,7 +272,7 @@ class RedisOperationsSessionRepositoryITests extends AbstractRedisITests {
}
@Test
void findByDeletedPrincipalNameReload() throws Exception {
void findByDeletedPrincipalNameReload() {
String principalName = "findByDeletedPrincipalName" + UUID.randomUUID();
RedisSession toSave = this.repository.createSession();
toSave.setAttribute(INDEX_NAME, principalName);
@@ -290,7 +290,7 @@ class RedisOperationsSessionRepositoryITests extends AbstractRedisITests {
}
@Test
void findByChangedPrincipalNameReload() throws Exception {
void findByChangedPrincipalNameReload() {
String principalName = "findByChangedPrincipalName" + UUID.randomUUID();
String principalNameChanged = "findByChangedPrincipalName" + UUID.randomUUID();
RedisSession toSave = this.repository.createSession();
@@ -336,7 +336,7 @@ class RedisOperationsSessionRepositoryITests extends AbstractRedisITests {
}
@Test
void findBySecurityPrincipalNameExpireRemovesIndex() throws Exception {
void findBySecurityPrincipalNameExpireRemovesIndex() {
RedisSession toSave = this.repository.createSession();
toSave.setAttribute(SPRING_SECURITY_CONTEXT, this.context);
@@ -357,7 +357,7 @@ class RedisOperationsSessionRepositoryITests extends AbstractRedisITests {
}
@Test
void findByPrincipalNameNoSecurityPrincipalNameChange() throws Exception {
void findByPrincipalNameNoSecurityPrincipalNameChange() {
RedisSession toSave = this.repository.createSession();
toSave.setAttribute(SPRING_SECURITY_CONTEXT, this.context);
@@ -374,7 +374,7 @@ class RedisOperationsSessionRepositoryITests extends AbstractRedisITests {
}
@Test
void findByPrincipalNameNoSecurityPrincipalNameChangeReload() throws Exception {
void findByPrincipalNameNoSecurityPrincipalNameChangeReload() {
RedisSession toSave = this.repository.createSession();
toSave.setAttribute(SPRING_SECURITY_CONTEXT, this.context);
@@ -393,7 +393,7 @@ class RedisOperationsSessionRepositoryITests extends AbstractRedisITests {
}
@Test
void findByDeletedSecurityPrincipalName() throws Exception {
void findByDeletedSecurityPrincipalName() {
RedisSession toSave = this.repository.createSession();
toSave.setAttribute(SPRING_SECURITY_CONTEXT, this.context);
@@ -409,7 +409,7 @@ class RedisOperationsSessionRepositoryITests extends AbstractRedisITests {
}
@Test
void findByChangedSecurityPrincipalName() throws Exception {
void findByChangedSecurityPrincipalName() {
RedisSession toSave = this.repository.createSession();
toSave.setAttribute(SPRING_SECURITY_CONTEXT, this.context);
@@ -429,7 +429,7 @@ class RedisOperationsSessionRepositoryITests extends AbstractRedisITests {
}
@Test
void findByDeletedSecurityPrincipalNameReload() throws Exception {
void findByDeletedSecurityPrincipalNameReload() {
RedisSession toSave = this.repository.createSession();
toSave.setAttribute(SPRING_SECURITY_CONTEXT, this.context);
@@ -446,7 +446,7 @@ class RedisOperationsSessionRepositoryITests extends AbstractRedisITests {
}
@Test
void findByChangedSecurityPrincipalNameReload() throws Exception {
void findByChangedSecurityPrincipalNameReload() {
RedisSession toSave = this.repository.createSession();
toSave.setAttribute(SPRING_SECURITY_CONTEXT, this.context);
@@ -468,7 +468,7 @@ class RedisOperationsSessionRepositoryITests extends AbstractRedisITests {
}
@Test
void changeSessionIdWhenOnlyChangeId() throws Exception {
void changeSessionIdWhenOnlyChangeId() {
String attrName = "changeSessionId";
String attrValue = "changeSessionId-value";
RedisSession toSave = this.repository.createSession();
@@ -493,7 +493,7 @@ class RedisOperationsSessionRepositoryITests extends AbstractRedisITests {
}
@Test
void changeSessionIdWhenChangeTwice() throws Exception {
void changeSessionIdWhenChangeTwice() {
RedisSession toSave = this.repository.createSession();
this.repository.save(toSave);
@@ -510,7 +510,7 @@ class RedisOperationsSessionRepositoryITests extends AbstractRedisITests {
}
@Test
void changeSessionIdWhenSetAttributeOnChangedSession() throws Exception {
void changeSessionIdWhenSetAttributeOnChangedSession() {
String attrName = "changeSessionId";
String attrValue = "changeSessionId-value";
@@ -535,7 +535,7 @@ class RedisOperationsSessionRepositoryITests extends AbstractRedisITests {
}
@Test
void changeSessionIdWhenHasNotSaved() throws Exception {
void changeSessionIdWhenHasNotSaved() {
String attrName = "changeSessionId";
String attrValue = "changeSessionId-value";

View File

@@ -41,7 +41,7 @@ class RedisOperationsSessionRepositoryFlushImmediatelyITests<S extends Session>
private SessionRepository<S> sessionRepository;
@Test
void savesOnCreate() throws InterruptedException {
void savesOnCreate() {
S created = this.sessionRepository.createSession();
S getSession = this.sessionRepository.findById(created.getId());

View File

@@ -296,7 +296,7 @@ public class RedisHttpSessionConfiguration extends SpringHttpSessionConfiguratio
}
@Override
public void afterPropertiesSet() throws Exception {
public void afterPropertiesSet() {
if (this.configure == ConfigureRedisAction.NO_OP) {
return;
}

View File

@@ -159,13 +159,13 @@ class RedisOperationsSessionRepositoryTests {
}
@Test
void createSessionDefaultMaxInactiveInterval() throws Exception {
void createSessionDefaultMaxInactiveInterval() {
Session session = this.redisRepository.createSession();
assertThat(session.getMaxInactiveInterval()).isEqualTo(new MapSession().getMaxInactiveInterval());
}
@Test
void createSessionCustomMaxInactiveInterval() throws Exception {
void createSessionCustomMaxInactiveInterval() {
int interval = 1;
this.redisRepository.setDefaultMaxInactiveInterval(interval);
Session session = this.redisRepository.createSession();

View File

@@ -80,7 +80,7 @@ class RedisSessionExpirationPolicyTests {
// gh-169
@Test
void onExpirationUpdatedRemovesOriginalExpirationTimeRoundedUp() throws Exception {
void onExpirationUpdatedRemovesOriginalExpirationTimeRoundedUp() {
long originalExpirationTimeInMs = ONE_MINUTE_AGO;
long originalRoundedToNextMinInMs = RedisSessionExpirationPolicy
.roundUpToNextMinute(originalExpirationTimeInMs);
@@ -94,7 +94,7 @@ class RedisSessionExpirationPolicyTests {
}
@Test
void onExpirationUpdatedDoNotSendDeleteWhenExpirationTimeDoesNotChange() throws Exception {
void onExpirationUpdatedDoNotSendDeleteWhenExpirationTimeDoesNotChange() {
long originalExpirationTimeInMs = RedisSessionExpirationPolicy.expiresInMillis(this.session) - 10;
long originalRoundedToNextMinInMs = RedisSessionExpirationPolicy
.roundUpToNextMinute(originalExpirationTimeInMs);
@@ -108,7 +108,7 @@ class RedisSessionExpirationPolicyTests {
}
@Test
void onExpirationUpdatedAddsExpirationTimeRoundedUp() throws Exception {
void onExpirationUpdatedAddsExpirationTimeRoundedUp() {
long expirationTimeInMs = RedisSessionExpirationPolicy.expiresInMillis(this.session);
long expirationRoundedUpInMs = RedisSessionExpirationPolicy.roundUpToNextMinute(expirationTimeInMs);
String expectedExpireKey = this.policy.getExpirationKey(expirationRoundedUpInMs);
@@ -122,7 +122,7 @@ class RedisSessionExpirationPolicyTests {
}
@Test
void onExpirationUpdatedSetExpireSession() throws Exception {
void onExpirationUpdatedSetExpireSession() {
String sessionKey = this.policy.getSessionKey(this.session.getId());
this.policy.onExpirationUpdated(null, this.session);
@@ -133,7 +133,7 @@ class RedisSessionExpirationPolicyTests {
}
@Test
void onExpirationUpdatedDeleteOnZero() throws Exception {
void onExpirationUpdatedDeleteOnZero() {
String sessionKey = this.policy.getSessionKey("expires:" + this.session.getId());
long originalExpirationTimeInMs = ONE_MINUTE_AGO;
@@ -151,7 +151,7 @@ class RedisSessionExpirationPolicyTests {
}
@Test
void onExpirationUpdatedPersistOnNegativeExpiration() throws Exception {
void onExpirationUpdatedPersistOnNegativeExpiration() {
long originalExpirationTimeInMs = ONE_MINUTE_AGO;
this.session.setMaxInactiveInterval(Duration.ofSeconds(-1));

View File

@@ -61,7 +61,7 @@ class EnableRedisKeyspaceNotificationsInitializerTests {
}
@Test
void afterPropertiesSetUnset() throws Exception {
void afterPropertiesSetUnset() {
setConfigNotification("");
this.initializer.afterPropertiesSet();
@@ -70,7 +70,7 @@ class EnableRedisKeyspaceNotificationsInitializerTests {
}
@Test
void afterPropertiesSetA() throws Exception {
void afterPropertiesSetA() {
setConfigNotification("A");
this.initializer.afterPropertiesSet();
@@ -79,7 +79,7 @@ class EnableRedisKeyspaceNotificationsInitializerTests {
}
@Test
void afterPropertiesSetE() throws Exception {
void afterPropertiesSetE() {
setConfigNotification("E");
this.initializer.afterPropertiesSet();
@@ -88,7 +88,7 @@ class EnableRedisKeyspaceNotificationsInitializerTests {
}
@Test
void afterPropertiesSetK() throws Exception {
void afterPropertiesSetK() {
setConfigNotification("K");
this.initializer.afterPropertiesSet();
@@ -97,7 +97,7 @@ class EnableRedisKeyspaceNotificationsInitializerTests {
}
@Test
void afterPropertiesSetAE() throws Exception {
void afterPropertiesSetAE() {
setConfigNotification("AE");
this.initializer.afterPropertiesSet();
@@ -106,7 +106,7 @@ class EnableRedisKeyspaceNotificationsInitializerTests {
}
@Test
void afterPropertiesSetAK() throws Exception {
void afterPropertiesSetAK() {
setConfigNotification("AK");
this.initializer.afterPropertiesSet();
@@ -115,7 +115,7 @@ class EnableRedisKeyspaceNotificationsInitializerTests {
}
@Test
void afterPropertiesSetEK() throws Exception {
void afterPropertiesSetEK() {
setConfigNotification("EK");
this.initializer.afterPropertiesSet();
@@ -124,7 +124,7 @@ class EnableRedisKeyspaceNotificationsInitializerTests {
}
@Test
void afterPropertiesSetEg() throws Exception {
void afterPropertiesSetEg() {
setConfigNotification("Eg");
this.initializer.afterPropertiesSet();
@@ -133,7 +133,7 @@ class EnableRedisKeyspaceNotificationsInitializerTests {
}
@Test
void afterPropertiesSetE$() throws Exception {
void afterPropertiesSetE$() {
setConfigNotification("E$");
this.initializer.afterPropertiesSet();
@@ -142,7 +142,7 @@ class EnableRedisKeyspaceNotificationsInitializerTests {
}
@Test
void afterPropertiesSetKg() throws Exception {
void afterPropertiesSetKg() {
setConfigNotification("Kg");
this.initializer.afterPropertiesSet();
@@ -151,7 +151,7 @@ class EnableRedisKeyspaceNotificationsInitializerTests {
}
@Test
void afterPropertiesSetAEK() throws Exception {
void afterPropertiesSetAEK() {
setConfigNotification("AEK");
this.initializer.afterPropertiesSet();

View File

@@ -47,8 +47,7 @@ class RedisHttpSessionConfigurationMockTests {
}
@Test
void enableRedisKeyspaceNotificationsInitializerAfterPropertiesSetWhenNoOpThenNoInteractionWithConnectionFactory()
throws Exception {
void enableRedisKeyspaceNotificationsInitializerAfterPropertiesSetWhenNoOpThenNoInteractionWithConnectionFactory() {
EnableRedisKeyspaceNotificationsInitializer init = new EnableRedisKeyspaceNotificationsInitializer(this.factory,
ConfigureRedisAction.NO_OP);
@@ -58,8 +57,7 @@ class RedisHttpSessionConfigurationMockTests {
}
@Test
void enableRedisKeyspaceNotificationsInitializerAfterPropertiesSetWhenExceptionThenCloseConnection()
throws Exception {
void enableRedisKeyspaceNotificationsInitializerAfterPropertiesSetWhenExceptionThenCloseConnection() {
ConfigureRedisAction action = mock(ConfigureRedisAction.class);
willThrow(new RuntimeException()).given(action).configure(this.connection);
@@ -77,8 +75,7 @@ class RedisHttpSessionConfigurationMockTests {
}
@Test
void enableRedisKeyspaceNotificationsInitializerAfterPropertiesSetWhenNoExceptionThenCloseConnection()
throws Exception {
void enableRedisKeyspaceNotificationsInitializerAfterPropertiesSetWhenNoExceptionThenCloseConnection() {
ConfigureRedisAction action = mock(ConfigureRedisAction.class);
EnableRedisKeyspaceNotificationsInitializer init = new EnableRedisKeyspaceNotificationsInitializer(this.factory,