diff options
author | 2018-09-27 18:55:03 +0530 | |
---|---|---|
committer | 2018-09-27 18:55:12 +0530 | |
commit | 4c4142a21bf93dc78ca4e02042e2a765c86e4dea (patch) | |
tree | d5f78c30ee23d109577d39a0b25f201c2ebbdc0e /ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk | |
parent | d6bd65c16c632f018434d55ac46feca84247b145 (diff) |
added test cases to DomainVOTest
to increase code coverage
Issue-ID: PORTAL-273
Change-Id: If34ad80569f9b503663efca8034a883b62a394f5
Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
Diffstat (limited to 'ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk')
-rw-r--r-- | ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/DomainVOTest.java | 130 |
1 files changed, 71 insertions, 59 deletions
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)); + } } |