@Test
  public void commandShouldBePreparedProperly() {

    Capture<CreateEntity> cmd = new Capture<CreateEntity>();
    expectDispatch(new GetSchema(), schema);
    captureDispatch(cmd);
    replay(dispatcher);

    UserDatabaseDTO newDb = new UserDatabaseDTO();
    newDb.setCountry(new CountryDTO(31, "Haiti"));
    newDb.setName("My Db");

    createPresenter();
    presenter.save(newDb, niceFormDialogMock());

    assertTrue("command was dispatched", cmd.hasCaptured());
    assertThat((Integer) cmd.getValue().getProperties().get("countryId"), is(equalTo(31)));
  }
  @Before
  public void setUp() throws Exception {

    ownedDb = new UserDatabaseDTO(OWNED_DB_ID, "My Database");
    ownedDb.setAmOwner(true);
    ownedDb.setDesignAllowed(true);
    ownedDb.setManageUsersAllowed(true);
    schema.getDatabases().add(ownedDb);

    designableDb = new UserDatabaseDTO(DESIGNABLE_DB_ID, "My Database");
    designableDb.setAmOwner(false);
    designableDb.setDesignAllowed(true);
    designableDb.setManageUsersAllowed(true);
    schema.getDatabases().add(designableDb);

    viewableDb = new UserDatabaseDTO(VIEWABLE_DB_ID, "My database");
    viewableDb.setAmOwner(false);
    viewableDb.setDesignAllowed(false);
    viewableDb.setManageUsersAllowed(false);
    schema.getDatabases().add(viewableDb);
  }