From 4c4142a21bf93dc78ca4e02042e2a765c86e4dea Mon Sep 17 00:00:00 2001 From: Sandeep J Date: Thu, 27 Sep 2018 18:55:03 +0530 Subject: added test cases to DomainVOTest to increase code coverage Issue-ID: PORTAL-273 Change-Id: If34ad80569f9b503663efca8034a883b62a394f5 Signed-off-by: Sandeep J --- .../core/domain/support/DomainVOTest.java | 130 +++++++++++---------- 1 file changed, 71 insertions(+), 59 deletions(-) (limited to 'ecomp-sdk/epsdk-domain') diff --git a/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/DomainVOTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/DomainVOTest.java index 93678128..9bac4db5 100644 --- a/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/DomainVOTest.java +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/DomainVOTest.java @@ -4,6 +4,8 @@ * =================================================================== * Copyright © 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== + * Modifications Copyright © 2018 IBM. + * =================================================================== * * Unless otherwise specified, all software contained herein is licensed * under the Apache License, Version 2.0 (the "License"); @@ -41,67 +43,77 @@ import static org.junit.Assert.assertEquals; import java.util.Date; +import org.junit.Before; import org.junit.Test; import org.onap.portalsdk.core.domain.support.DomainVo; public class DomainVOTest { - - public DomainVo mockDomainVO(){ - DomainVo domainVo = new DomainVo(); - - domainVo.setId((long) 1); - domainVo.setCreated(new Date()); - domainVo.setModified(new Date()); - domainVo.setCreatedId((long) 1); - domainVo.setModifiedId((long) 1); - domainVo.setRowNum((long) 1); - domainVo.setAuditUserId(null); - domainVo.setAuditTrail(null); - - return domainVo; - } - - @Test - public void domainVoTest(){ - DomainVo domainVo = mockDomainVO(); - - DomainVo domainVo1 = new DomainVo(); - domainVo1.setId((long) 1); - domainVo1.setCreated(new Date()); - domainVo1.setModified(new Date()); - domainVo1.setCreatedId((long) 1); - domainVo1.setModifiedId((long) 1); - domainVo1.setRowNum((long) 1); - domainVo1.setAuditUserId(null); - domainVo1.setAuditTrail(null); - - assertEquals(domainVo.getId(), domainVo1.getId()); -// assertEquals(domainVo.getCreated(), domainVo1.getCreated()); -// assertEquals(domainVo.getModified(), domainVo1.getModified()); - assertEquals(domainVo.getCreatedId(), domainVo1.getCreatedId()); - assertEquals(domainVo.getModifiedId(), domainVo1.getModifiedId()); - assertEquals(domainVo.getRowNum(), domainVo1.getRowNum()); - assertEquals(domainVo.getAuditUserId(), domainVo1.getAuditUserId()); - assertEquals(domainVo.getAuditTrail(), domainVo1.getAuditTrail()); - } - - @Test - public void copyTest(){ - DomainVo domainVo = mockDomainVO(); - domainVo.copy(true); - } - - @Test - public void equalTest(){ - DomainVo domainVo1 = mockDomainVO(); - DomainVo domainVo2 = mockDomainVO(); -// assertEquals(true, domainVo1.equals(domainVo2)); - } - - @Test - public void compareTest(){ - DomainVo domainVo1 = mockDomainVO(); - DomainVo domainVo2 = mockDomainVO(); - assertEquals(0, domainVo1.compareTo(domainVo2)); - } + + public Date date; + + @Before + public void setUp() + { + date= new Date("23/09/2018"); + } + + public DomainVo mockDomainVO(){ + DomainVo domainVo = new DomainVo(); + + domainVo.setId((long) 1); + domainVo.setCreated(new Date()); + domainVo.setModified(new Date()); + domainVo.setCreatedId((long) 1); + domainVo.setModifiedId((long) 1); + domainVo.setRowNum((long) 1); + domainVo.setAuditUserId(null); + domainVo.setAuditTrail(null); + domainVo.setCreated(date); + domainVo.setModified(date); + return domainVo; + } + + @Test + public void domainVoTest(){ + DomainVo domainVo = mockDomainVO(); + + DomainVo domainVo1 = new DomainVo(); + domainVo1.setId((long) 1); + domainVo1.setCreated(date); + domainVo1.setModified(date); + domainVo1.setCreatedId((long) 1); + domainVo1.setModifiedId((long) 1); + domainVo1.setRowNum((long) 1); + domainVo1.setAuditUserId(null); + domainVo1.setAuditTrail(null); + + assertEquals(domainVo.getId(), domainVo1.getId()); + assertEquals(domainVo.getCreated(), domainVo1.getCreated()); + assertEquals(domainVo.getModified(), domainVo1.getModified()); + assertEquals(domainVo.getCreatedId(), domainVo1.getCreatedId()); + assertEquals(domainVo.getModifiedId(), domainVo1.getModifiedId()); + assertEquals(domainVo.getRowNum(), domainVo1.getRowNum()); + assertEquals(domainVo.getAuditUserId(), domainVo1.getAuditUserId()); + assertEquals(domainVo.getAuditTrail(), domainVo1.getAuditTrail()); + } + + @Test + public void copyTest(){ + DomainVo domainVo = mockDomainVO(); + domainVo.copy(true); + } + + @Test + public void equalTest(){ + DomainVo domainVo1 = mockDomainVO(); + DomainVo domainVo2 = mockDomainVO(); + assertEquals(true, domainVo1.equals(domainVo2)); + } + + @Test + public void compareTest(){ + DomainVo domainVo1 = mockDomainVO(); + DomainVo domainVo2 = mockDomainVO(); + assertEquals(0, domainVo1.compareTo(domainVo2)); + } } -- cgit 1.2.3-korg