added test cases to SequenceFormatter.java 99/66099/1
authorSandeep J <sandeejh@in.ibm.com>
Wed, 12 Sep 2018 12:08:39 +0000 (17:38 +0530)
committerSandeep J <sandeejh@in.ibm.com>
Wed, 12 Sep 2018 12:09:26 +0000 (17:39 +0530)
to increase code coverage for PolicySequence.java

Issue-ID: CCSDK-552
Change-Id: Ia630d079f1bbdd583e98b7a162f036a0b3a0d1ed
Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/SequenceFormatterTest.java

index df28ccc..5a16131 100644 (file)
@@ -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());
+    }
 }