summaryrefslogtreecommitdiffstats
path: root/rulemgt/src/test/java/org
diff options
context:
space:
mode:
authorGuangrongFu <fu.guangrong@zte.com.cn>2017-02-17 17:23:57 +0800
committerGuangrongFu <fu.guangrong@zte.com.cn>2017-02-17 17:26:57 +0800
commit7b2af8900a4b1de780a4c78ab6b9ff5b621ff7d6 (patch)
treed79fe57e91dc7881322b4079f48cd64db602a891 /rulemgt/src/test/java/org
parent1ddc6d2f4b2761c0ecd836cfe76bf14c9ce27c18 (diff)
Add new unit tests for java beans
Change-Id: I2b10b32f98f066a553446f2e4d4deb274eb3e981 Issue-ID: HOLMES-12 Signed-off-by: GuangrongFu <fu.guangrong@zte.com.cn>
Diffstat (limited to 'rulemgt/src/test/java/org')
-rw-r--r--rulemgt/src/test/java/org/openo/holmes/rulemgt/bean/request/RuleCreateRequestTest.java58
-rw-r--r--rulemgt/src/test/java/org/openo/holmes/rulemgt/bean/request/RuleDeleteRequestTest.java33
2 files changed, 91 insertions, 0 deletions
diff --git a/rulemgt/src/test/java/org/openo/holmes/rulemgt/bean/request/RuleCreateRequestTest.java b/rulemgt/src/test/java/org/openo/holmes/rulemgt/bean/request/RuleCreateRequestTest.java
new file mode 100644
index 0000000..3f5469d
--- /dev/null
+++ b/rulemgt/src/test/java/org/openo/holmes/rulemgt/bean/request/RuleCreateRequestTest.java
@@ -0,0 +1,58 @@
+/**
+ * Copyright 2017 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.openo.holmes.rulemgt.bean.request;
+
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsEqual.equalTo;
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class RuleCreateRequestTest {
+
+ @Test
+ public void getterAndSetter4RuleName(){
+ final String rulename = "rulename";
+ RuleCreateRequest ruleCreateRequest = new RuleCreateRequest();
+ ruleCreateRequest.setRuleName(rulename);
+ assertThat(ruleCreateRequest.getRuleName(), equalTo(rulename));
+ }
+
+ @Test
+ public void getterAndSetter4Description(){
+ final String description = "desc";
+ RuleCreateRequest ruleCreateRequest = new RuleCreateRequest();
+ ruleCreateRequest.setDescription(description);
+ assertThat(ruleCreateRequest.getDescription(), equalTo(description));
+ }
+
+ @Test
+ public void getterAndSetter4Content(){
+ final String contents = "contents";
+ RuleCreateRequest ruleCreateRequest = new RuleCreateRequest();
+ ruleCreateRequest.setContent(contents);
+ assertThat(ruleCreateRequest.getContent(), equalTo(contents));
+ }
+
+ @Test
+ public void getterAndSetter4Enabled(){
+ final int enabled = 0;
+ RuleCreateRequest ruleCreateRequest = new RuleCreateRequest();
+ ruleCreateRequest.setEnabled(enabled);
+ assertThat(ruleCreateRequest.getEnabled(), is(enabled));
+ }
+} \ No newline at end of file
diff --git a/rulemgt/src/test/java/org/openo/holmes/rulemgt/bean/request/RuleDeleteRequestTest.java b/rulemgt/src/test/java/org/openo/holmes/rulemgt/bean/request/RuleDeleteRequestTest.java
new file mode 100644
index 0000000..f9a09ff
--- /dev/null
+++ b/rulemgt/src/test/java/org/openo/holmes/rulemgt/bean/request/RuleDeleteRequestTest.java
@@ -0,0 +1,33 @@
+/**
+ * Copyright 2017 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.openo.holmes.rulemgt.bean.request;
+
+import static org.hamcrest.core.IsEqual.equalTo;
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+
+public class RuleDeleteRequestTest {
+ @Test
+ public void getterAndSetter4RuleId(){
+ final String ruleId = "ruleId";
+ RuleDeleteRequest ruleDeleteRequest = new RuleDeleteRequest();
+ ruleDeleteRequest.setRuleId(ruleId);
+ assertThat(ruleDeleteRequest.getRuleId(), equalTo(ruleId));
+ }
+} \ No newline at end of file