summaryrefslogtreecommitdiffstats
path: root/appc-dispatcher/appc-dispatcher-common/execution-queue-management-lib/src/test/java/org/onap/appc/executionqueue/TestExecutionQueueService.java
diff options
context:
space:
mode:
Diffstat (limited to 'appc-dispatcher/appc-dispatcher-common/execution-queue-management-lib/src/test/java/org/onap/appc/executionqueue/TestExecutionQueueService.java')
-rw-r--r--appc-dispatcher/appc-dispatcher-common/execution-queue-management-lib/src/test/java/org/onap/appc/executionqueue/TestExecutionQueueService.java24
1 files changed, 19 insertions, 5 deletions
diff --git a/appc-dispatcher/appc-dispatcher-common/execution-queue-management-lib/src/test/java/org/onap/appc/executionqueue/TestExecutionQueueService.java b/appc-dispatcher/appc-dispatcher-common/execution-queue-management-lib/src/test/java/org/onap/appc/executionqueue/TestExecutionQueueService.java
index f09809258..8d2549dce 100644
--- a/appc-dispatcher/appc-dispatcher-common/execution-queue-management-lib/src/test/java/org/onap/appc/executionqueue/TestExecutionQueueService.java
+++ b/appc-dispatcher/appc-dispatcher-common/execution-queue-management-lib/src/test/java/org/onap/appc/executionqueue/TestExecutionQueueService.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2017 Amdocs
+ * ================================================================================
+ * Modifications Copyright (C) 2019 Ericsson
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,9 +25,14 @@
package org.onap.appc.executionqueue;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.times;
+import java.util.concurrent.TimeUnit;
import org.junit.Assert;
import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mockito;
@@ -36,14 +43,12 @@ import org.onap.appc.executionqueue.impl.ExecutionQueueServiceImpl;
import org.onap.appc.executionqueue.impl.QueueManager;
import org.powermock.modules.junit4.PowerMockRunner;
-import java.util.concurrent.TimeUnit;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.times;
-
@RunWith(PowerMockRunner.class)
public class TestExecutionQueueService {
+ @Rule
+ public ExpectedException expectedEx = ExpectedException.none();
+
@InjectMocks
ExecutionQueueServiceImpl service;
@Spy
@@ -66,4 +71,13 @@ public class TestExecutionQueueService {
Assert.fail(e.toString());
}
}
+
+ @Test
+ public void testPutMessageExceptionFlow() throws APPCException {
+ QueueManager queueManager = Mockito.mock(QueueManager.class);
+ Mockito.when(queueManager.enqueueTask(Mockito.any())).thenReturn(false);
+ service.setQueueManager(queueManager);
+ expectedEx.expect(APPCException.class);
+ service.putMessage(new Thread(), 1, TimeUnit.MILLISECONDS);
+ }
}