15
15
*/
16
16
package org .springframework .session .data .mongo .config .annotation .web .http ;
17
17
18
+ import static org .assertj .core .api .Assertions .*;
19
+ import static org .mockito .ArgumentMatchers .anyString ;
20
+ import static org .mockito .BDDMockito .*;
21
+
22
+
18
23
import org .junit .After ;
19
24
import org .junit .Rule ;
20
25
import org .junit .Test ;
21
26
import org .junit .rules .ExpectedException ;
22
27
import org .springframework .beans .factory .BeanCreationException ;
23
- import org .springframework .context .annotation .*;
28
+ import org .springframework .context .annotation .AnnotationConfigApplicationContext ;
29
+ import org .springframework .context .annotation .Bean ;
30
+ import org .springframework .context .annotation .Configuration ;
31
+ import org .springframework .context .annotation .Import ;
32
+ import org .springframework .context .annotation .Primary ;
24
33
import org .springframework .context .support .PropertySourcesPlaceholderConfigurer ;
25
34
import org .springframework .data .mongodb .core .MongoOperations ;
26
35
import org .springframework .data .mongodb .core .index .IndexOperations ;
29
38
import org .springframework .session .data .mongo .MongoOperationsSessionRepository ;
30
39
import org .springframework .test .util .ReflectionTestUtils ;
31
40
32
- import static org .assertj .core .api .Assertions .assertThat ;
33
- import static org .assertj .core .api .Assertions .assertThatExceptionOfType ;
34
- import static org .mockito .ArgumentMatchers .anyString ;
35
- import static org .mockito .BDDMockito .given ;
36
- import static org .mockito .BDDMockito .mock ;
37
-
38
41
/**
39
42
* Tests for {@link MongoHttpSessionConfiguration}.
40
43
*
@@ -47,8 +50,7 @@ public class MongoHttpSessionConfigurationTest {
47
50
48
51
private static final int MAX_INACTIVE_INTERVAL_IN_SECONDS = 600 ;
49
52
50
- @ Rule
51
- public final ExpectedException thrown = ExpectedException .none ();
53
+ @ Rule public final ExpectedException thrown = ExpectedException .none ();
52
54
53
55
private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext ();
54
56
@@ -106,8 +108,8 @@ public void customMaxInactiveIntervalInSeconds() {
106
108
MongoOperationsSessionRepository repository = this .context .getBean (MongoOperationsSessionRepository .class );
107
109
108
110
assertThat (repository ).isNotNull ();
109
- assertThat (ReflectionTestUtils .getField (repository , "maxInactiveIntervalInSeconds" )). isEqualTo (
110
- MAX_INACTIVE_INTERVAL_IN_SECONDS );
111
+ assertThat (ReflectionTestUtils .getField (repository , "maxInactiveIntervalInSeconds" ))
112
+ . isEqualTo ( MAX_INACTIVE_INTERVAL_IN_SECONDS );
111
113
}
112
114
113
115
@ Test
@@ -118,8 +120,8 @@ public void setCustomMaxInactiveIntervalInSeconds() {
118
120
MongoOperationsSessionRepository repository = this .context .getBean (MongoOperationsSessionRepository .class );
119
121
120
122
assertThat (repository ).isNotNull ();
121
- assertThat (ReflectionTestUtils .getField (repository , "maxInactiveIntervalInSeconds" )). isEqualTo (
122
- MAX_INACTIVE_INTERVAL_IN_SECONDS );
123
+ assertThat (ReflectionTestUtils .getField (repository , "maxInactiveIntervalInSeconds" ))
124
+ . isEqualTo ( MAX_INACTIVE_INTERVAL_IN_SECONDS );
123
125
}
124
126
125
127
@ Test
@@ -138,8 +140,7 @@ public void setCustomSessionConverterConfiguration() {
138
140
@ Test
139
141
public void resolveCollectionNameByPropertyPlaceholder () {
140
142
141
- this .context .setEnvironment (
142
- new MockEnvironment ().withProperty ("session.mongo.collectionName" , COLLECTION_NAME ));
143
+ this .context .setEnvironment (new MockEnvironment ().withProperty ("session.mongo.collectionName" , COLLECTION_NAME ));
143
144
registerAndRefresh (CustomMongoJdbcSessionConfiguration .class );
144
145
145
146
MongoHttpSessionConfiguration configuration = this .context .getBean (MongoHttpSessionConfiguration .class );
0 commit comments