From 46173b499aae8546afe19c010e887aad5bb981dd Mon Sep 17 00:00:00 2001 From: Seshu-Kumar-M Date: Mon, 12 Mar 2018 16:57:18 +0530 Subject: Class to improve for SO/libs coverage Issue-ID: SO-360 Change-Id: Iaa5ec998c1d6b471e9af83f82a124e0f0cfba8ad Signed-off-by: Seshu-Kumar-M --- .../openstack/nova/model/ServerActionTest.java | 74 ++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 nova-model/src/test/java/com/woorea/openstack/nova/model/ServerActionTest.java (limited to 'nova-model/src/test/java/com') diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerActionTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerActionTest.java new file mode 100644 index 0000000..d60ee9b --- /dev/null +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerActionTest.java @@ -0,0 +1,74 @@ +/*- + * ============LICENSE_START======================================================= + * 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. + * ============LICENSE_END========================================================= + */ + +package com.woorea.openstack.nova.model; + +import com.woorea.openstack.nova.model.ServerAction.ChangePassword; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + + +public class ServerActionTest { + private ChangePassword testObj = new ServerAction.ChangePassword(); + + @Test + public void testSetAdminPass(){ + + try { + + testObj.setAdminPass("sai"); + assertEquals( testObj.getAdminPass(), "sai"); + + } catch (Exception e) { + + fail("Exception in test obj"); + } + + } + + @Test + public void testChangePasswdConstructor(){ + + try { + ServerAction.ChangePassword test = new ServerAction.ChangePassword("sai"); + assertEquals( test.getAdminPass(), "sai"); + + } catch (Exception e) { + + fail("Exception in test obj"); + } + + } + + private ServerAction.Reboot testObj1 = new ServerAction.Reboot(); + + @Test + public void testSetType(){ + testObj1.setType("sai"); + assertEquals("sai", testObj1.getType()); + } + + private ServerAction.Rebuild testRebuild = new ServerAction.Rebuild(); + + @Test + public void testRebuild() + { + testRebuild.setAccessIPv4("1.1.1.1"); + assertEquals(testRebuild.getAccessIPv4(),"1.1.1.1"); + } +} -- cgit 1.2.3-korg