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