throws IOException, JMException
{
Mockery context = new Mockery();
final MBeanServerConnection con = context.mock( MBeanServerConnection.class );
command.setDomain( domainName );
MockSession session = new MockSession( output, con );
context.checking( new Expectations()
{
{
one( con ).getDomains();
will( returnValue( knownDomains ) );
}
} );
command.setSession( session );
command.execute();
assertEquals( domainName, session.getDomain() );
context.assertIsSatisfied();
}