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