1 package com.atlassian.plugins.rest.common.expand.resolver;
2
3 import static org.junit.Assert.*;
4 import org.junit.Before;
5 import org.junit.Test;
6
7 import java.util.Collection;
8 import java.util.List;
9
10
11
12
13 public class CollectionEntityExpanderResolverTest
14 {
15 private CollectionEntityExpanderResolver resolver;
16
17 @Before
18 public void setUp() throws Exception
19 {
20 resolver = new CollectionEntityExpanderResolver();
21 }
22
23 @Test
24 public void testHasExpanderWithNullClass()
25 {
26 try
27 {
28 final Class clazz = null;
29 resolver.hasExpander(clazz);
30 fail();
31 }
32 catch (NullPointerException e)
33 {
34
35 }
36 }
37
38 @Test
39 public void testHasExpanderWithClassForCollection()
40 {
41 assertTrue(resolver.hasExpander(Collection.class));
42 }
43
44 @Test
45 public void testHasExpanderWithClassForList()
46 {
47 assertTrue(resolver.hasExpander(List.class));
48 }
49
50 @Test
51 public void testHasExpanderWithClassForObject()
52 {
53 assertFalse(resolver.hasExpander(Object.class));
54 }
55
56 @Test
57 public void testGetExpanderWithClassForCollection()
58 {
59 assertNotNull(resolver.getExpander(Collection.class));
60 }
61
62 @Test
63 public void testGetExpanderWithClassForList()
64 {
65 assertNotNull(resolver.getExpander(List.class));
66 }
67
68 @Test
69 public void testGetExpanderWithClassForObject()
70 {
71 assertNull(resolver.getExpander(Object.class));
72 }
73 }