1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package net.fckeditor.handlers;
22
23 import static org.junit.Assert.*;
24 import org.junit.Test;
25
26
27
28
29
30
31 public class CommandTest {
32
33 @Test
34 public void valueOf01() {
35 assertEquals(Command.FILE_UPLOAD, Command
36 .valueOf("FileUpload"));
37 }
38
39 @Test
40 public void valueOf02() {
41 assertEquals(Command.QUICK_UPLOAD, Command
42 .valueOf("QuickUpload"));
43 }
44
45 @Test
46 public void valueOf03() {
47 assertEquals(Command.CREATE_FOLDER, Command
48 .valueOf("CreateFolder"));
49 }
50
51 @Test
52 public void valueOf04() {
53 assertEquals(Command.GET_FOLDERS, Command
54 .valueOf("GetFolders"));
55 }
56
57 @Test
58 public void valueOf05() {
59 assertEquals(Command.GET_FOLDERS_AND_FILES, Command
60 .valueOf("GetFoldersAndFiles"));
61 }
62
63 @Test(expected = NullPointerException.class)
64 public void valueOfStringNull() {
65 Command.valueOf(null);
66 }
67
68 @Test(expected = IllegalArgumentException.class)
69 public void valueOfInvalidCommand() {
70 Command.valueOf("GetAll");
71 }
72
73 @Test
74 public void getCommandNull() {
75 Command command = Command.getCommand(null);
76 assertNull(command);
77 }
78
79 @Test
80 public void getCommandInvalid() {
81 Command command = Command.getCommand("DeleteFolders");
82 assertNull(command);
83 }
84
85 @Test
86 public void getCommandValid() {
87 Command actual = Command.getCommand("FileUpload");
88 assertEquals(Command.FILE_UPLOAD, actual);
89 }
90
91 @Test
92 public void equalsNot01() {
93 assertFalse(Command.GET_FOLDERS
94 .equals(Command.FILE_UPLOAD));
95 }
96
97 @Test
98 public void equalsNot02() {
99 assertFalse(Command.GET_FOLDERS.equals(new Object()));
100 }
101
102 @Test
103 public void hashCode01() {
104 assertEquals("GetFoldersAndFiles".hashCode(),
105 Command.GET_FOLDERS_AND_FILES.hashCode());
106 }
107
108 @Test
109 public void hashCode02() {
110 assertNotSame(-1, Command.FILE_UPLOAD.hashCode());
111 }
112
113 @Test
114 public void toString01() {
115 assertEquals("GetFoldersAndFiles", Command.GET_FOLDERS_AND_FILES
116 .toString());
117 }
118
119 }