added test case to TestSignal.java 21/58921/3
authorSandeep J <sandeejh@in.ibm.com>
Fri, 3 Aug 2018 11:03:46 +0000 (16:33 +0530)
committerTakamune Cho <tc012c@att.com>
Fri, 3 Aug 2018 20:55:18 +0000 (20:55 +0000)
to increase code coverage

Issue-ID: APPC-1086
Change-Id: Iba603fd695d9f5e2a70fa08f07272e407d0db00c
Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
appc-common/src/test/java/org/onap/appc/concurrent/TestSignal.java

index 68ab02e..a5cd553 100644 (file)
@@ -6,6 +6,8 @@
  * ================================================================================
  * Copyright (C) 2017 Amdocs
  * =============================================================================
+ * Modification 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
@@ -25,7 +27,7 @@ package org.onap.appc.concurrent;
 
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
-
+import static org.junit.Assert.assertEquals;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.Date;
@@ -34,6 +36,8 @@ import java.util.concurrent.TimeoutException;
 import org.junit.Test;
 import org.onap.appc.concurrent.Signal;
 
+
+
 public class TestSignal {
 
     private static final DateFormat formatter = new SimpleDateFormat("HH:mm:ss.SSS");
@@ -119,7 +123,7 @@ public class TestSignal {
                 System.out.println(formatter.format(new Date()) + " FRED: Received shutdown");
                 completed = true;
             } catch (TimeoutException e) {
-                e.printStackTrace();
+                
             }
         }
 
@@ -131,4 +135,13 @@ public class TestSignal {
             return signal;
         }
     }
+    
+    @Test
+    public void testWaitForAny() throws Exception
+    {
+        Signal mySignal = new Signal(Thread.currentThread());
+        mySignal.setTimeout(50L);
+        String receivedSignal= mySignal.waitForAny(SIGNAL_READY);
+        assertEquals("READY", receivedSignal);
+    }
 }