1
2
3
4
5
6
7
8
9
10
11 package org.mule.context;
12
13 import org.mule.api.MuleContext;
14 import org.mule.api.MuleException;
15 import org.mule.tck.junit4.AbstractMuleContextTestCase;
16
17 import org.junit.Test;
18
19 import static org.junit.Assert.assertFalse;
20 import static org.junit.Assert.assertTrue;
21
22 public class DefaultMuleContextTestCase extends AbstractMuleContextTestCase
23 {
24
25 @Test
26 public void testDisposal() throws MuleException, InterruptedException
27 {
28 int threadsBeforeStart = Thread.activeCount();
29 MuleContext ctx = new DefaultMuleContextFactory().createMuleContext();
30 ctx.start();
31 assertTrue(Thread.activeCount() > threadsBeforeStart);
32 ctx.stop();
33 ctx.dispose();
34
35 assertTrue(Thread.activeCount() == threadsBeforeStart);
36 assertTrue(ctx.isDisposed());
37 assertFalse(ctx.isInitialised());
38 assertFalse(ctx.isStarted());
39 }
40
41 @Override
42 protected MuleContext createMuleContext() throws Exception
43 {
44 return null;
45 }
46 }