import org.easymock.EasyMock;
public class CreateCommandTest extends TestCase {
public void testCreateCommandExecute() throws Exception {
InstanceService instanceService = EasyMock.createMock(InstanceService.class);
EasyMock.replay(instanceService);
CreateCommand cc = new CreateCommand();
cc.setInstanceService(instanceService);
cc.sshPort = 9941;
cc.rmiRegistryPort = 1122;
cc.rmiServerPort = 44444;
cc.location = "top";
cc.javaOpts = "foo";
cc.features = Arrays.asList("abc", "def");
cc.featureURLs = Collections.singletonList("http://something");
cc.instance = "myInstance";
cc.verbose = true;
EasyMock.verify(instanceService); // check precondition
EasyMock.reset(instanceService);
InstanceSettings expectedIS =
new InstanceSettings(9941, 1122, 44444, "top", "foo", Collections.singletonList("http://something"), Arrays.asList("abc", "def"));
EasyMock.expect(instanceService.createInstance("myInstance", expectedIS, true)).andReturn(null);
EasyMock.replay(instanceService);
cc.doExecute();
EasyMock.verify(instanceService);
}