1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package net.fckeditor;
22
23 import javax.servlet.http.HttpServletRequest;
24
25 import org.junit.Test;
26 import static org.mockito.Mockito.*;
27
28
29
30
31 public class FCKeditorTest {
32
33 @Test(expected = NullPointerException.class)
34 public void testNullRequest() {
35 new FCKeditor(null, "name");
36 }
37
38 @Test(expected = IllegalArgumentException.class)
39 public void testEmptyInstanceName() {
40 HttpServletRequest request = mock(HttpServletRequest.class);
41
42 new FCKeditor(request, null);
43 }
44
45 @Test(expected = IllegalArgumentException.class)
46 public void testEmptyInstanceName02() {
47 HttpServletRequest request = mock(HttpServletRequest.class);
48
49 new FCKeditor(request, "");
50 }
51
52 @Test(expected = IllegalArgumentException.class)
53 public void testIllegalInstanceName() {
54 HttpServletRequest request = mock(HttpServletRequest.class);
55
56 new FCKeditor(request, "my instance");
57 }
58
59 @Test(expected = IllegalArgumentException.class)
60 public void testIllegalInstanceName02() {
61 HttpServletRequest request = mock(HttpServletRequest.class);
62
63 new FCKeditor(request, "01_instance");
64 }
65
66 @Test
67 public void testValidInstanceName() {
68 HttpServletRequest request = mock(HttpServletRequest.class);
69
70 new FCKeditor(request, "myInstance");
71 }
72
73 }