From ad050dd208c39b76de12f7654f11ee95ff9bc54b Mon Sep 17 00:00:00 2001 From: Sandeep J Date: Wed, 12 Sep 2018 17:38:39 +0530 Subject: added test cases to SequenceFormatter.java to increase code coverage for PolicySequence.java Issue-ID: CCSDK-552 Change-Id: Ia630d079f1bbdd583e98b7a162f036a0b3a0d1ed Signed-off-by: Sandeep J --- .../ms/neng/core/gen/SequenceFormatterTest.java | 43 +++++++++++++++++++++- 1 file changed, 41 insertions(+), 2 deletions(-) (limited to 'ms/neng/src') diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/SequenceFormatterTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/SequenceFormatterTest.java index df28ccce..5a161319 100644 --- a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/SequenceFormatterTest.java +++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/SequenceFormatterTest.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * 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 @@ -22,13 +24,22 @@ package org.onap.ccsdk.apps.ms.neng.core.gen; import static org.junit.Assert.assertEquals; +import org.junit.Before; import org.junit.Test; import org.onap.ccsdk.apps.ms.neng.core.policy.PolicySequence; public class SequenceFormatterTest { + + private PolicySequence poly; + + @Before + public void setUp() + { + poly = new PolicySequence(); + } + @Test public void formatSequence() throws Exception { - PolicySequence poly = new PolicySequence(); poly.setLength(3);; assertEquals("001", SequenceFormatter.formatSequence(1, poly)); poly.setLength(2);; @@ -39,7 +50,6 @@ public class SequenceFormatterTest { @Test public void formatSequenceAlpha() throws Exception { - PolicySequence poly = new PolicySequence(); poly.setLength(3);; poly.setType(PolicySequence.Type.ALPHA); assertEquals("001", SequenceFormatter.formatSequence(1, poly)); @@ -48,4 +58,33 @@ public class SequenceFormatterTest { poly.setLength(4);; assertEquals("000b", SequenceFormatter.formatSequence(11, poly)); } + + @Test + public void testGetSetIncrement() + { + poly.setIncrement(1L); + assertEquals(1L, poly.getIncrement()); + } + + @Test + public void testGetSetMaxValue() + { + poly.setMaxValue(1L); + assertEquals(1L, poly.getMaxValue()); + } + + @Test + public void testGetSetKey() + { + poly.setKey("testKey"); + assertEquals("testKey", poly.getKey()); + } + + @Test + public void testGetSetLastReleaseSeqNumTried() + { + poly.setLastReleaseSeqNumTried(1L); + Long expected=1L; + assertEquals(expected, poly.getLastReleaseSeqNumTried()); + } } -- cgit 1.2.3-korg