[SDC-29] Amdocs OnBoard 1707 initial commit.
[sdc.git] / common / openecomp-logging-lib / openecomp-logging-api / src / test / java / org / openecomp / core / logging / api / context / TaskFactoryTest.java
1 package org.openecomp.core.logging.api.context;
2
3 import org.testng.annotations.Test;
4
5 import java.util.ServiceLoader;
6
7 import static org.testng.Assert.*;
8
9 /**
10  * @author evitaliy
11  * @since 14/09/2016.
12  */
13 public class TaskFactoryTest {
14
15   @Test(expectedExceptions = RuntimeException.class)
16   public void testNoImplementation() throws Exception {
17
18     assertFalse(ServiceLoader.load(ContextPropagationService.class).iterator().hasNext());
19
20     try {
21       TaskFactory.create(() -> {
22       });
23     } catch (RuntimeException e) {
24       Throwable cause = e.getCause();
25       assertNotNull(cause);
26       assertTrue(cause.getMessage().contains(ContextPropagationService.class.getName()));
27       throw e;
28     }
29   }
30 }