Session Optional<T> getAttribute -> T getAttribute

Issue gh-819
This commit is contained in:
Rob Winch
2017-06-30 10:07:58 -05:00
parent ab3e280993
commit 8ef36e4f3e
19 changed files with 120 additions and 167 deletions

View File

@@ -15,12 +15,7 @@
*/
package org.springframework.session.data.redis;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -42,6 +37,9 @@ import org.springframework.session.events.SessionCreatedEvent;
import org.springframework.session.events.SessionDestroyedEvent;
import org.springframework.test.context.ContextConfiguration;
import java.util.Map;
import java.util.UUID;
import static org.assertj.core.api.Assertions.assertThat;
@ContextConfiguration
@@ -102,7 +100,7 @@ public class RedisOperationsSessionRepositoryITests extends AbstractITests {
assertThat(this.registry.getEvent(toSave.getId()).getSession()
.<String>getAttribute(expectedAttributeName))
.isEqualTo(Optional.of(expectedAttributeValue));
.isEqualTo(expectedAttributeValue);
}
@Test
@@ -120,8 +118,8 @@ public class RedisOperationsSessionRepositoryITests extends AbstractITests {
Session session = this.repository.findById(toSave.getId());
assertThat(session.getAttributeNames().size()).isEqualTo(2);
assertThat(session.<String>getAttribute("a")).isEqualTo(Optional.of("b"));
assertThat(session.<String>getAttribute("1")).isEqualTo(Optional.of("2"));
assertThat(session.<String>getAttribute("a")).isEqualTo("b");
assertThat(session.<String>getAttribute("1")).isEqualTo("2");
this.repository.deleteById(toSave.getId());
}