File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed
src/test/java/com/arhs/spring/cache/mongo Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change 1
1
package com .arhs .spring .cache .mongo ;
2
2
3
+ import com .arhs .spring .cache .mongo .serializer .JavaSerializer ;
4
+ import org .junit .Test ;
5
+ import org .junit .runner .RunWith ;
6
+ import org .springframework .beans .factory .annotation .Autowired ;
7
+ import org .springframework .data .mongodb .core .MongoTemplate ;
8
+ import org .springframework .test .context .ContextConfiguration ;
9
+ import org .springframework .test .context .junit4 .SpringRunner ;
10
+
11
+ @ RunWith (SpringRunner .class )
12
+ @ ContextConfiguration (classes = TestConfiguration .class )
3
13
public class MongoCacheBuilderTest {
14
+
15
+ private static final String CACHE_NAME = "cache" ;
16
+ private static final String COLLECTION_NAME = "test" ;
17
+ private static final long TTL = 0 ;
18
+
19
+ @ Autowired
20
+ private MongoTemplate mongoTemplate ;
21
+
22
+ @ Test
23
+ public void testBuildWithSerializer () {
24
+ MongoCacheBuilder builder = new MongoCacheBuilder (
25
+ COLLECTION_NAME ,
26
+ mongoTemplate ,
27
+ CACHE_NAME
28
+ );
29
+ builder .withSerializer (new JavaSerializer ());
30
+ builder .withTTL (TTL );
31
+ builder .withFlushOnBoot (false );
32
+ builder .build ();
33
+ }
34
+
35
+ @ Test
36
+ public void testBuildWithoutSerializer () {
37
+ MongoCacheBuilder builder = new MongoCacheBuilder (
38
+ COLLECTION_NAME ,
39
+ mongoTemplate ,
40
+ CACHE_NAME
41
+ );
42
+ builder .withTTL (TTL );
43
+ builder .withFlushOnBoot (false );
44
+ builder .build ();
45
+ }
46
+
4
47
}
You can’t perform that action at this time.
0 commit comments