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