throws IOException, JMException
{
Mockery context = new Mockery();
final MBeanServerConnection con = context.mock( MBeanServerConnection.class );
command.setBean( beanName );
MockSession s = new MockSession( output, con );
if ( domainName != null )
{
s.setDomain( domainName );
}
context.checking( new Expectations()
{
{
atLeast( 1 ).of( con ).getMBeanInfo( new ObjectName( expectedBean ) );
}
} );
command.setSession( s );
command.execute();
assertEquals( expectedBean, s.getBean() );
}