|
1 | 1 | /*
|
2 |
| - * Copyright 2014-2019 the original author or authors. |
| 2 | + * Copyright 2014-2020 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
@@ -102,18 +102,36 @@ void setKeyNamespace_ValidNamespace_ShouldSetNamespace() {
|
102 | 102 | assertThat(ReflectionTestUtils.getField(this.sessionRepository, "keyNamespace")).isEqualTo("test:");
|
103 | 103 | }
|
104 | 104 |
|
| 105 | + @Test |
| 106 | + void setRedisKeyNamespace_ValidNamespace_ShouldSetNamespace() { |
| 107 | + this.sessionRepository.setRedisKeyNamespace("test"); |
| 108 | + assertThat(ReflectionTestUtils.getField(this.sessionRepository, "keyNamespace")).isEqualTo("test:"); |
| 109 | + } |
| 110 | + |
105 | 111 | @Test
|
106 | 112 | void setKeyNamespace_NullNamespace_ShouldThrowException() {
|
107 | 113 | assertThatIllegalArgumentException().isThrownBy(() -> this.sessionRepository.setKeyNamespace(null))
|
108 | 114 | .withMessage("keyNamespace must not be empty");
|
109 | 115 | }
|
110 | 116 |
|
| 117 | + @Test |
| 118 | + void setRedisKeyNamespace_NullNamespace_ShouldThrowException() { |
| 119 | + assertThatIllegalArgumentException().isThrownBy(() -> this.sessionRepository.setRedisKeyNamespace(null)) |
| 120 | + .withMessage("namespace must not be empty"); |
| 121 | + } |
| 122 | + |
111 | 123 | @Test
|
112 | 124 | void setKeyNamespace_EmptyNamespace_ShouldThrowException() {
|
113 | 125 | assertThatIllegalArgumentException().isThrownBy(() -> this.sessionRepository.setKeyNamespace(" "))
|
114 | 126 | .withMessage("keyNamespace must not be empty");
|
115 | 127 | }
|
116 | 128 |
|
| 129 | + @Test |
| 130 | + void setRedisKeyNamespace_EmptyNamespace_ShouldThrowException() { |
| 131 | + assertThatIllegalArgumentException().isThrownBy(() -> this.sessionRepository.setRedisKeyNamespace(" ")) |
| 132 | + .withMessage("namespace must not be empty"); |
| 133 | + } |
| 134 | + |
117 | 135 | @Test
|
118 | 136 | void setFlushMode_ValidFlushMode_ShouldSetFlushMode() {
|
119 | 137 | this.sessionRepository.setFlushMode(FlushMode.IMMEDIATE);
|
@@ -185,7 +203,7 @@ void save_NewSession_ShouldSaveSession() {
|
185 | 203 |
|
186 | 204 | @Test
|
187 | 205 | void save_NewSessionAndCustomKeyNamespace_ShouldSaveSession() {
|
188 |
| - this.sessionRepository.setKeyNamespace("custom:"); |
| 206 | + this.sessionRepository.setRedisKeyNamespace("custom"); |
189 | 207 | RedisSession session = this.sessionRepository.createSession();
|
190 | 208 | this.sessionRepository.save(session);
|
191 | 209 | String key = "custom:sessions:" + session.getId();
|
|
0 commit comments