diff options
5 files changed, 321 insertions, 15 deletions
diff --git a/appc-dg/appc-dg-shared/appc-dg-aai/src/main/java/org/onap/appc/dg/aai/impl/AAIPluginImpl.java b/appc-dg/appc-dg-shared/appc-dg-aai/src/main/java/org/onap/appc/dg/aai/impl/AAIPluginImpl.java index 3304b093b..3044236b2 100644 --- a/appc-dg/appc-dg-shared/appc-dg-aai/src/main/java/org/onap/appc/dg/aai/impl/AAIPluginImpl.java +++ b/appc-dg/appc-dg-shared/appc-dg-aai/src/main/java/org/onap/appc/dg/aai/impl/AAIPluginImpl.java @@ -5,6 +5,8 @@ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Copyright (C) 2017 Amdocs + * ================================================================================ + * Modifications (C) 2019 Ericsson * ============================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -209,6 +211,7 @@ public class AAIPluginImpl implements AAIPlugin { String vnfcType = vnfcQueryResult.getAdditionProperties().get(PROPERTY_VNFC_TYPE); Vnfc newVnfc = createVnfc(vnfcName, vnfcType); + if (vnfcSet.contains(newVnfc)) { Vnfc vnfcFromSet = vnfcSet.stream().filter(vnfc -> vnfc.equals(newVnfc)) .collect(Collectors.toList()).get(0); @@ -293,7 +296,7 @@ public class AAIPluginImpl implements AAIPlugin { return readRelationDataAndProperties(prefix, vnfContext, additionalProperties); } - private AAIQueryResult readVM(String vmId, String tenantId, String cloudOwner, String cloudRegionId) + protected AAIQueryResult readVM(String vmId, String tenantId, String cloudOwner, String cloudRegionId) throws AAIQueryException { String query = "vserver.vserver-id = '" + vmId + "' AND tenant.tenant_id = '" + tenantId + "' AND cloud-region.cloud-owner = '" @@ -308,7 +311,7 @@ public class AAIPluginImpl implements AAIPlugin { return readRelationDataAndProperties(prefix, vnfContext, additionalProperties); } - private AAIQueryResult readVnf(String vnfId) throws AAIQueryException { + protected AAIQueryResult readVnf(String vnfId) throws AAIQueryException { String query = "generic-vnf.vnf-id = '" + vnfId + "'"; String prefix = "VNF"; SvcLogicContext vnfContext = readResource(query, prefix, PARAM_GENERIC_VNF); @@ -323,7 +326,6 @@ public class AAIPluginImpl implements AAIPlugin { private AAIQueryResult readRelationDataAndProperties(String prefix, SvcLogicContext context, String[] additionalProperties) { AAIQueryResult result = new AAIQueryResult(); - if (context != null && context.getAttribute(prefix + ".relationship-list.relationship_length") != null) { Integer relationsCount = Integer.parseInt(context.getAttribute( prefix + ".relationship-list.relationship_length")); @@ -369,7 +371,7 @@ public class AAIPluginImpl implements AAIPlugin { return result; } - private SvcLogicContext readResource(String query, String prefix, String resourceType) throws AAIQueryException { + protected SvcLogicContext readResource(String query, String prefix, String resourceType) throws AAIQueryException { SvcLogicContext resourceContext = new SvcLogicContext(); try { SvcLogicResource.QueryStatus response = aaiClient diff --git a/appc-dg/appc-dg-shared/appc-dg-aai/src/test/java/org/onap/appc/dg/aai/impl/AAIPluginImplTest.java b/appc-dg/appc-dg-shared/appc-dg-aai/src/test/java/org/onap/appc/dg/aai/impl/AAIPluginImplTest.java new file mode 100644 index 000000000..d89bd4730 --- /dev/null +++ b/appc-dg/appc-dg-shared/appc-dg-aai/src/test/java/org/onap/appc/dg/aai/impl/AAIPluginImplTest.java @@ -0,0 +1,299 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2018 Ericsson + * ============================================================================= + * 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 org.onap.appc.dg.aai.impl; + +import static org.hamcrest.CoreMatchers.isA; +import java.util.HashMap; +import java.util.Map; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.junit.runner.RunWith; +import org.mockito.Matchers; +import org.mockito.Mockito; +import org.onap.appc.dg.aai.exception.AAIQueryException; +import org.onap.appc.dg.aai.objects.AAIQueryResult; +import org.onap.appc.dg.aai.objects.Relationship; +import org.onap.appc.exceptions.APPCException; +import org.onap.appc.i18n.Msg; +import org.onap.ccsdk.sli.adaptors.aai.AAIClient; +import org.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.onap.ccsdk.sli.core.sli.SvcLogicResource; +import org.osgi.framework.FrameworkUtil; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; +import com.att.eelf.i18n.EELFResourceManager; +import org.hamcrest.CoreMatchers; +import org.junit.Assert; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; +import org.powermock.api.mockito.PowerMockito; + +@RunWith(PowerMockRunner.class) +@PrepareForTest(FrameworkUtil.class) +public class AAIPluginImplTest { + + private final BundleContext bundleContext = Mockito.mock(BundleContext.class); + private final Bundle bundleService = Mockito.mock(Bundle.class); + private final ServiceReference sref = Mockito.mock(ServiceReference.class); + private final AAIClient aaiClient = Mockito.mock(AAIClient.class); + private SvcLogicContext ctx; + private Map<String, String> params; + + @Rule + public ExpectedException expectedEx = ExpectedException.none(); + + @Before + public void setUp() throws NoSuchFieldException, IllegalAccessException { + PowerMockito.mockStatic(FrameworkUtil.class); + PowerMockito.when(FrameworkUtil.getBundle(Matchers.any(Class.class))).thenReturn(bundleService); + PowerMockito.when(bundleService.getBundleContext()).thenReturn(bundleContext); + PowerMockito.when(bundleContext.getServiceReference(Matchers.any(Class.class))).thenReturn(sref); + PowerMockito.when(bundleContext.<AAIClient>getService(sref)).thenReturn(aaiClient); + params = new HashMap<String, String>(); + params.put(Constants.AAI_INPUT_DATA + ".suffix", "TEST_DATA"); + } + + @Test + public void testPostGenericVnfDataNotFound() throws APPCException, SvcLogicException { + SvcLogicResource.QueryStatus status = SvcLogicResource.QueryStatus.NOT_FOUND; + Mockito.doReturn(status).when(aaiClient).update(Mockito.anyString(), Mockito.anyString(), + Mockito.anyMap(), Mockito.anyString(), Mockito.any(SvcLogicContext.class)); + ctx = new SvcLogicContext(); + AAIPluginImpl impl = new AAIPluginImpl(); + impl.initialize(); + expectedEx.expect(APPCException.class); + expectedEx.expectMessage("VNF not found with vnf_id null"); + impl.postGenericVnfData(params, ctx); + } + + @Test + public void testPostGenericVnfDataFailure() throws APPCException, SvcLogicException { + SvcLogicResource.QueryStatus status = SvcLogicResource.QueryStatus.FAILURE; + Mockito.doReturn(status).when(aaiClient).update(Mockito.anyString(), Mockito.anyString(), + Mockito.anyMap(), Mockito.anyString(), Mockito.any(SvcLogicContext.class)); + ctx = new SvcLogicContext(); + AAIPluginImpl impl = new AAIPluginImpl(); + impl.initialize(); + expectedEx.expect(APPCException.class); + expectedEx.expectMessage("Error Querying AAI with vnfID = null"); + impl.postGenericVnfData(params, ctx); + } + + @Test + public void testPostGenericVnfDataSucces() throws APPCException, SvcLogicException { + SvcLogicResource.QueryStatus status = SvcLogicResource.QueryStatus.SUCCESS; + Mockito.doReturn(status).when(aaiClient).update(Mockito.anyString(), Mockito.anyString(), + Mockito.anyMap(), Mockito.anyString(), Mockito.any(SvcLogicContext.class)); + ctx = new SvcLogicContext(); + AAIPluginImpl impl = new AAIPluginImpl(); + impl.initialize(); + impl.postGenericVnfData(params, ctx); + Assert.assertThat(ctx.getAttribute(org.onap.appc.Constants.ATTRIBUTE_SUCCESS_MESSAGE), CoreMatchers.containsString( + "Operation PostGenericVnfData succeed for VNF ID null")); + } + + @Test + public void testPostGenericVnfDataFailureThrownExeption() throws APPCException, SvcLogicException { + Mockito.doThrow(new SvcLogicException()).when(aaiClient).update(Mockito.anyString(), Mockito.anyString(), + Mockito.anyMap(), Mockito.anyString(), Mockito.any(SvcLogicContext.class)); + ctx = new SvcLogicContext(); + AAIPluginImpl impl = new AAIPluginImpl(); + impl.initialize(); + expectedEx.expect(APPCException.class); + expectedEx.expectCause(isA(SvcLogicException.class)); + impl.postGenericVnfData(params, ctx); + } + + @Test + public void testGetGenericVnfDataNotFound() throws APPCException, SvcLogicException { + SvcLogicResource.QueryStatus notFound = SvcLogicResource.QueryStatus.NOT_FOUND; + Mockito.doReturn(notFound).when(aaiClient).query(Mockito.anyString(), Mockito.anyBoolean(), Mockito.anyString(), + Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.any(SvcLogicContext.class)); + ctx = new SvcLogicContext(); + AAIPluginImpl impl = new AAIPluginImpl(); + impl.initialize(); + expectedEx.expect(APPCException.class); + expectedEx.expectMessage("VNF not found with vnf_id null"); + impl.getGenericVnfData(params, ctx); + } + + @Test + public void testGetGenericVnfDataFailure() throws APPCException, SvcLogicException { + SvcLogicResource.QueryStatus status = SvcLogicResource.QueryStatus.FAILURE; + Mockito.doReturn(status).when(aaiClient).query(Mockito.anyString(), Mockito.anyBoolean(), Mockito.anyString(), + Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.any(SvcLogicContext.class)); + ctx = new SvcLogicContext(); + AAIPluginImpl impl = new AAIPluginImpl(); + impl.initialize(); + expectedEx.expect(APPCException.class); + expectedEx.expectMessage("Error Querying AAI with vnfID = null"); + impl.getGenericVnfData(params, ctx); + } + + @Test + public void testGetGenericVnfDataSucces() throws APPCException, SvcLogicException { + SvcLogicResource.QueryStatus status = SvcLogicResource.QueryStatus.SUCCESS; + Mockito.doReturn(status).when(aaiClient).query(Mockito.anyString(), Mockito.anyBoolean(), Mockito.anyString(), + Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.any(SvcLogicContext.class)); + ctx = new SvcLogicContext(); + AAIPluginImpl impl = new AAIPluginImpl(); + impl.initialize(); + impl.getGenericVnfData(params, ctx); + Assert.assertThat(ctx.getAttribute(org.onap.appc.Constants.ATTRIBUTE_SUCCESS_MESSAGE), CoreMatchers.containsString( + "Operation GetGenericVnfData succeed for VNF ID null")); + } + + @Test + public void testGetGenericVnfDataFailureThrownExeption() throws APPCException, SvcLogicException { + Mockito.doThrow(new SvcLogicException()).when(aaiClient).query(Mockito.anyString(), Mockito.anyBoolean(), Mockito.anyString(), + Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.any(SvcLogicContext.class)); + ctx = new SvcLogicContext(); + AAIPluginImpl impl = new AAIPluginImpl(); + impl.initialize(); + expectedEx.expect(APPCException.class); + expectedEx.expectCause(isA(SvcLogicException.class)); + impl.getGenericVnfData(params, ctx); + } + + @Test + public void testGetVnfHierarchyAaiExceptionFlow() throws APPCException, SvcLogicException { + SvcLogicResource.QueryStatus status = SvcLogicResource.QueryStatus.FAILURE; + Mockito.doReturn(status).when(aaiClient).query(Mockito.anyString(), Mockito.anyBoolean(), Mockito.anyString(), + Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.any(SvcLogicContext.class)); + ctx = new SvcLogicContext(); + params.put(Constants.RESOURCEKEY, "TEST_RESOURCE_KEY"); + AAIPluginImpl impl = new AAIPluginImpl(); + impl.initialize(); + expectedEx.expect(APPCException.class); + expectedEx.expectMessage("Error Retrieving VNF hierarchy"); + impl.getVnfHierarchy(params, ctx); + } + + @Test + public void testGetVnfHierarchyAaiExceptionFlow2() throws APPCException, SvcLogicException { + Mockito.doThrow(new SvcLogicException()).when(aaiClient).query(Mockito.anyString(), Mockito.anyBoolean(), Mockito.anyString(), + Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.any(SvcLogicContext.class)); + ctx = new SvcLogicContext(); + params.put(Constants.RESOURCEKEY, "TEST_RESOURCE_KEY"); + AAIPluginImpl impl = new AAIPluginImpl(); + impl.initialize(); + expectedEx.expect(APPCException.class); + expectedEx.expectMessage("Error Retrieving VNF hierarchy"); + impl.getVnfHierarchy(params, ctx); + } + + @Test + public void testGetVnfHierarchyNoVMs() throws APPCException, SvcLogicException { + SvcLogicResource.QueryStatus status = SvcLogicResource.QueryStatus.SUCCESS; + Mockito.doReturn(status).when(aaiClient).query(Mockito.anyString(), Mockito.anyBoolean(), Mockito.anyString(), + Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.any(SvcLogicContext.class)); + ctx = new SvcLogicContext(); + params.put(Constants.RESOURCEKEY, "TEST_RESOURCE_KEY"); + AAIPluginImpl impl = new AAIPluginImpl(); + impl.initialize(); + impl.getVnfHierarchy(params, ctx); + Assert.assertEquals("0", ctx.getAttribute("VNF.VMCount")); + } + + @Test + public void testGetVnfHierarchy() throws APPCException, SvcLogicException, AAIQueryException { + String vnfId = "TEST_RESOURCE_KEY"; + SvcLogicResource.QueryStatus status = SvcLogicResource.QueryStatus.SUCCESS; + Mockito.doReturn(status).when(aaiClient).query(Mockito.anyString(), Mockito.anyBoolean(), Mockito.anyString(), + Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.any(SvcLogicContext.class)); + ctx = new SvcLogicContext(); + params.put(Constants.RESOURCEKEY, "TEST_RESOURCE_KEY"); + AAIPluginImpl impl = Mockito.spy(new AAIPluginImpl()); + AAIQueryResult aaiQueryResult = new AAIQueryResult(); + aaiQueryResult.getAdditionProperties().put("vnf-type", "TEST_VNF_TYPE"); + Relationship relationship = new Relationship(); + relationship.setRelatedTo("vserver"); + aaiQueryResult.getRelationshipList().add(relationship); + Mockito.doReturn(aaiQueryResult).when(impl).readVnf(vnfId); + AAIQueryResult vmQueryResult = new AAIQueryResult(); + vmQueryResult.getAdditionProperties().put("vserver-selflink", "TEST_VM_NAME"); + Relationship vmRelationship = new Relationship(); + vmRelationship.setRelatedTo("vnfc"); + vmQueryResult.getRelationshipList().add(vmRelationship); + Mockito.doReturn(vmQueryResult).when(impl).readVM(null, null, null, null); + impl.initialize(); + impl.getVnfHierarchy(params, ctx); + Assert.assertEquals(EELFResourceManager.format(Msg.SUCCESS_EVENT_MESSAGE, "GetVNFHierarchy", "VNF ID " + vnfId), + ctx.getAttribute(org.onap.appc.Constants.ATTRIBUTE_SUCCESS_MESSAGE)); + } + + @Test + public void testReadVM() throws AAIQueryException { + AAIPluginImpl impl = Mockito.spy(new AAIPluginImpl()); + ctx = new SvcLogicContext(); + ctx.setAttribute("VM.relationship-list.relationship_length", "1"); + ctx.setAttribute("VM.relationship-list.relationship[0].relationship-data_length", "1"); + ctx.setAttribute("VM.relationship-list.relationship[0].related-to-property_length", "1"); + Mockito.doReturn(ctx).when(impl).readResource("vserver.vserver-id = 'null' AND tenant.tenant_id = 'null' AND " + + "cloud-region.cloud-owner = 'null' AND cloud-region.cloud-region-id = 'null'", "VM", "vserver"); + impl.initialize(); + Assert.assertEquals(null, impl.readVM(null, null, null, null).getAdditionProperties().get("resource-version")); + } + + @Test + public void testGetResource() throws SvcLogicException, APPCException { + SvcLogicResource.QueryStatus status = SvcLogicResource.QueryStatus.SUCCESS; + Mockito.doReturn(status).when(aaiClient).query(Mockito.anyString(), Mockito.anyBoolean(), Mockito.anyString(), + Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.any(SvcLogicContext.class)); + ctx = new SvcLogicContext(); + params.put(Constants.RESOURCEKEY, "TEST_RESOURCE_KEY"); + AAIPluginImpl impl = new AAIPluginImpl(); + impl.initialize(); + impl.getResource(params, ctx); + Assert.assertEquals("SUCCESS",ctx.getAttribute("getResource_result")); + } + + @Test + public void testPostResource() throws SvcLogicException, APPCException { + SvcLogicResource.QueryStatus status = SvcLogicResource.QueryStatus.SUCCESS; + Mockito.doReturn(status).when(aaiClient).update(Mockito.anyString(), Mockito.anyString(), + Mockito.anyMap(), Mockito.anyString(), Mockito.any(SvcLogicContext.class)); + ctx = new SvcLogicContext(); + params.put(Constants.RESOURCEKEY, "TEST_RESOURCE_KEY"); + AAIPluginImpl impl = new AAIPluginImpl(); + impl.initialize(); + impl.postResource(params, ctx); + Assert.assertEquals("SUCCESS",ctx.getAttribute("postResource_result")); + } + + @Test + public void testDeleteResource() throws SvcLogicException, APPCException { + SvcLogicResource.QueryStatus status = SvcLogicResource.QueryStatus.SUCCESS; + Mockito.doReturn(status).when(aaiClient).delete(Mockito.anyString(), Mockito.anyString(), + Mockito.any(SvcLogicContext.class)); + ctx = new SvcLogicContext(); + params.put(Constants.RESOURCEKEY, "TEST_RESOURCE_KEY"); + AAIPluginImpl impl = new AAIPluginImpl(); + impl.initialize(); + impl.deleteResource(params, ctx); + Assert.assertEquals("SUCCESS",ctx.getAttribute("deleteResource_result")); + } +} diff --git a/appc-dg/appc-dg-shared/appc-dg-aai/src/test/java/org/onap/appc/dg/aai/impl/TestConstants.java b/appc-dg/appc-dg-shared/appc-dg-aai/src/test/java/org/onap/appc/dg/aai/impl/TestConstants.java index 80fc68cdf..ec562f0a0 100644 --- a/appc-dg/appc-dg-shared/appc-dg-aai/src/test/java/org/onap/appc/dg/aai/impl/TestConstants.java +++ b/appc-dg/appc-dg-shared/appc-dg-aai/src/test/java/org/onap/appc/dg/aai/impl/TestConstants.java @@ -3,6 +3,8 @@ * ONAP : APPC * ================================================================================ * Copyright 2018 TechMahindra +* ================================================================================ +* Modifications Copyright (C) 2019 Ericsson *================================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,12 +27,11 @@ import org.junit.Test; import org.onap.appc.dg.aai.impl.Constants.SDC_ARTIFACTS_FIELDS; public class TestConstants { - private Constants constants=new Constants(); private SDC_ARTIFACTS_FIELDS c=SDC_ARTIFACTS_FIELDS.SERVICE_NAME; @Test public void testConstants() { - Assert.assertEquals("sdnctl",constants.NETCONF_SCHEMA); + Assert.assertEquals("sdnctl",Constants.NETCONF_SCHEMA); } @Test diff --git a/appc-dg/appc-dg-shared/appc-dg-aai/src/test/java/org/onap/appc/dg/aai/objects/TestAAIQueryResult.java b/appc-dg/appc-dg-shared/appc-dg-aai/src/test/java/org/onap/appc/dg/aai/objects/TestAAIQueryResult.java index b88a878f8..7f606c37c 100644 --- a/appc-dg/appc-dg-shared/appc-dg-aai/src/test/java/org/onap/appc/dg/aai/objects/TestAAIQueryResult.java +++ b/appc-dg/appc-dg-shared/appc-dg-aai/src/test/java/org/onap/appc/dg/aai/objects/TestAAIQueryResult.java @@ -3,6 +3,8 @@ * ONAP : APPC * ================================================================================ * Copyright 2018 TechMahindra +* ================================================================================ +* Modifications Copyright (C) 2019 Ericsson *================================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,11 +19,11 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.appc.dg.aai.objects; import java.util.HashMap; import java.util.Map; - import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -30,7 +32,7 @@ public class TestAAIQueryResult { private AAIQueryResult aaiQueryResult; private Map<String,String> additionProperties; - + @Before public void setUp() { aaiQueryResult=new AAIQueryResult(); @@ -55,7 +57,7 @@ public class TestAAIQueryResult { @Test public void testGetAdditionProperties_IsEmpty() { - Assert.assertTrue(aaiQueryResult. getAdditionProperties().isEmpty()); + Assert.assertTrue(aaiQueryResult.getAdditionProperties().isEmpty()); } @Test diff --git a/appc-dg/appc-dg-shared/appc-dg-aai/src/test/java/org/onap/appc/dg/aai/objects/TestRelationship.java b/appc-dg/appc-dg-shared/appc-dg-aai/src/test/java/org/onap/appc/dg/aai/objects/TestRelationship.java index f0b832a1f..cb3a7756a 100644 --- a/appc-dg/appc-dg-shared/appc-dg-aai/src/test/java/org/onap/appc/dg/aai/objects/TestRelationship.java +++ b/appc-dg/appc-dg-shared/appc-dg-aai/src/test/java/org/onap/appc/dg/aai/objects/TestRelationship.java @@ -3,6 +3,8 @@ * ONAP : APPC * ================================================================================ * Copyright 2018 TechMahindra +* ================================================================================ +* Modifications Copyright (C) 2019 Ericsson *================================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,11 +19,11 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.appc.dg.aai.objects; import java.util.HashMap; import java.util.Map; - import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -30,7 +32,7 @@ public class TestRelationship { private Relationship relationship; private Map<String,String> relationShipDataMap; private Map<String,String> relatedProperties; - + @Before public void setUp() { relationship=new Relationship(); @@ -42,14 +44,14 @@ public class TestRelationship { public void testGetRelatedTo() { relationship.setRelatedTo("relatedTo"); Assert.assertNotNull(relationship.getRelatedTo()); - Assert.assertEquals("relatedTo",relationship.getRelatedTo()); + Assert.assertEquals("relatedTo", relationship.getRelatedTo()); } @Test public void testGetRelatedLink() { relationship.setRelatedLink("relatedLink"); Assert.assertNotNull(relationship.getRelatedLink()); - Assert.assertEquals("relatedLink",relationship.getRelatedLink()); + Assert.assertEquals("relatedLink", relationship.getRelatedLink()); } @Test @@ -66,12 +68,12 @@ public class TestRelationship { @Test public void testGetRelationShipDataMap_WithValidKey() { relationShipDataMap.put("2", "B"); - Assert.assertEquals("B",relationShipDataMap.get("2")); + Assert.assertEquals("B", relationShipDataMap.get("2")); } @Test public void testgetRelationShipDataMap_WithInValidKey() { - Assert.assertEquals(null,relationShipDataMap.get("3")); + Assert.assertEquals(null, relationShipDataMap.get("3")); } @Test |