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