package org.xbean.jmx;

import junit.framework.TestCase;
import org.xbean.spring.context.ClassPathXmlApplicationContext;

import java.util.List;

/**
 * $Rev$
 */
public class JMXTest extends TestCase {
    public void testSimple() throws Exception {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("org/xbean/jmx/jmx-simple.xml");
        try {
            Object jmxService = context.getBean("jmxService");
            assertNotNull(jmxService);

            Object jmxExporter = context.getBean("jmxExporter");
            assertNotNull(jmxExporter);
            assertTrue(jmxExporter instanceof MBeanExporter);
            List mbeans = ((MBeanExporter) jmxExporter).getMBeans();
            assertNotNull(mbeans);
            assertEquals(2, mbeans.size());
            assertSame(jmxService, mbeans.get(0));
            assertSame(jmxService, mbeans.get(1));
        } finally {
            context.destroy();
        }
    }
}

package org.xbean.jmx;

import junit.framework.TestCase;
import org.xbean.spring.context.ClassPathXmlApplicationContext;

/**
 * $Rev$
 */
public class JMXTest extends TestCase {
    public void testSimple() throws Exception {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("org/xbean/jmx/jmx-simple.xml");
        try {
            Object jmxService = context.getBean("jmxService");
            assertNotNull(jmxService);

            Object jmxExporter = context.getBean("jmxExporter");
            assertNotNull(jmxExporter);
        } finally {
            context.destroy();
        }
    }
}

--- 
+++ 
@@ -2,6 +2,8 @@
 
 import junit.framework.TestCase;
 import org.xbean.spring.context.ClassPathXmlApplicationContext;
+
+import java.util.List;
 
 /**
  * $Rev$
@@ -15,6 +17,12 @@
 
             Object jmxExporter = context.getBean("jmxExporter");
             assertNotNull(jmxExporter);
+            assertTrue(jmxExporter instanceof MBeanExporter);
+            List mbeans = ((MBeanExporter) jmxExporter).getMBeans();
+            assertNotNull(mbeans);
+            assertEquals(2, mbeans.size());
+            assertSame(jmxService, mbeans.get(0));
+            assertSame(jmxService, mbeans.get(1));
         } finally {
             context.destroy();
         }
Add a few asserts to the test

git-svn-id: c55cfc7c8893d43c3333f2d886128b43c8520716@380472 13f79535-47bb-0310-9956-ffa450edef68
