private void createCommandMap() {
        map = new CommandMap();

        map.add("exit", new Command() {
            @Override
            public void execute() {
                frame.dispose();
            }
        });

        map.add("exchange", new Command() {
            @Override
            public void execute() {
                double amount = (isDoubleAndNotEmpty(frame.getAmount().getText()) ? Double.valueOf(frame.getAmount().getText()) : 0);
                Money moneyFrom = new Money(amount, CurrencySet.getInstance().search(frame.getCurrencyFrom().toString()));
                ExchangeRate rate = new MockExchangeRateLoader().load(moneyFrom.getCurrency(), CurrencySet.getInstance().search(frame.getCurrencyTo().toString()));
                moneycalculator.money.MoneyCalculator calculator = new moneycalculator.money.MoneyCalculator(moneyFrom, rate);
                Money result = calculator.exchange();
                frame.getResult().setText(Double.toString(moneyFrom.getAmount()) + " " + result.getCurrency().getCode());
            }

            private boolean isDoubleAndNotEmpty(String text) {
                try {
                    Double.parseDouble(text);
                }
                catch (NumberFormatException e) {
                    return false;
                }
                return (text.length() > 0);
            }
        });
    }