Add action module unit tests
[holmes/common.git] / holmes-actions / src / test / java / org / openo / holmes / common / utils / JudgeNullUtilTest.java
diff --git a/holmes-actions/src/test/java/org/openo/holmes/common/utils/JudgeNullUtilTest.java b/holmes-actions/src/test/java/org/openo/holmes/common/utils/JudgeNullUtilTest.java
new file mode 100644 (file)
index 0000000..25da9ac
--- /dev/null
@@ -0,0 +1,44 @@
+/**\r
+ * Copyright 2016 ZTE Corporation.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *     http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+\r
+package org.openo.holmes.common.utils;\r
+\r
+import static org.hamcrest.core.IsEqual.equalTo;\r
+import static org.junit.Assert.assertThat;\r
+\r
+import java.util.List;\r
+import org.junit.Test;\r
+\r
+public class JudgeNullUtilTest {\r
+\r
+    @Test\r
+    public void isEmpty_array() {\r
+        boolean resultShorts = JudgeNullUtil.isEmpty(new short[]{});\r
+        boolean resultInts = JudgeNullUtil.isEmpty(new int[]{});\r
+        boolean resultLongs = JudgeNullUtil.isEmpty(new long[]{});\r
+        boolean resultObjects = JudgeNullUtil.isEmpty(new Object[]{});\r
+        boolean resultStrings = JudgeNullUtil.isEmpty(new String[]{});\r
+        boolean resultLists = JudgeNullUtil.isEmpty(new List[]{});\r
+        assertThat(true, equalTo(resultShorts));\r
+        assertThat(true, equalTo(resultInts));\r
+        assertThat(true, equalTo(resultLongs));\r
+        assertThat(true, equalTo(resultObjects));\r
+        assertThat(true, equalTo(resultStrings));\r
+        assertThat(true, equalTo(resultLists));\r
+    }\r
+\r
+}
\ No newline at end of file