1 package org.ogf.saga.context;
2
3 import org.junit.Test;
4 import java.lang.reflect.InvocationTargetException;
5 import java.lang.reflect.Method;
6
7
8
9
10
11
12
13
14
15
16
17
18
19 public abstract class ContextDestroyTest extends ContextTest {
20
21 protected ContextDestroyTest(String contextId) throws Exception {
22 super(contextId);
23 }
24
25 @Test
26 public void destroy() throws Exception {
27
28 Context context = ContextFactory.createContext();
29 context.setAttribute(Context.TYPE, m_contextId);
30
31
32 destroyContext(context);
33 }
34
35 private static void destroyContext(Context context) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
36 Method m = context.getClass().getMethod("destroy");
37 if (m != null) {
38 m.invoke(context);
39 }
40 }
41 }