added test cases to CachedElementTest.java 42/79442/3
authorSandeep J <sandeejh@in.ibm.com>
Fri, 1 Mar 2019 11:01:24 +0000 (16:31 +0530)
committerJoss Armstrong <joss.armstrong@ericsson.com>
Mon, 4 Mar 2019 14:31:45 +0000 (14:31 +0000)
to increase code coverage

Issue-ID: APPC-1086
Change-Id: Idfb3ce36d41fdec4a5286da63b8a9592c1c83a96
Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
appc-core/appc-common-bundle/src/test/java/org/onap/appc/pool/CachedElementTest.java

index 02bdd3b..0d0c08a 100644 (file)
@@ -6,6 +6,8 @@
  * ================================================================================
  * Copyright (C) 2017 Amdocs
  * =============================================================================
+ * Modifications Copyright (C) 2019 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
@@ -27,6 +29,7 @@ package org.onap.appc.pool;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
@@ -272,4 +275,21 @@ public class CachedElementTest implements Allocator<Testable>, Destructor<Testab
     public void destroy(Testable obj, Pool<Testable> pool) {
         destroyCount++;
     }
+    
+    @Test
+    public void testGetWrappedObject()
+    {
+        Testable element = new Element(index++);
+        CachedElement cachedElement = new CachedElement(pool, element);
+        assertNotNull(cachedElement.getWrappedObject());
+        assertSame(element, cachedElement.getWrappedObject());
+    }
+    
+    @Test
+    public void testToString()
+    {
+        Testable element = new Element(index++);
+        CachedElement cachedElement = new CachedElement(pool, element);
+        assertTrue(cachedElement.toString() instanceof String);
+    }
 }