Added more tests.

This commit is contained in:
Erik C. Thauvin 2019-04-08 01:41:59 -07:00
parent 1d7fcbd6ad
commit d592536aca
2 changed files with 10 additions and 7 deletions

View file

@ -84,7 +84,7 @@ public final class CurrencyConverter extends AbstractModule {
commands.add(CURRENCY_CMD);
}
static Message converyCurrency(String query) throws ModuleException {
static Message convertCurrency(String query) throws ModuleException {
if (EXCHANGE_RATES.isEmpty()) {
try {
final SAXBuilder builder = new SAXBuilder();
@ -201,7 +201,7 @@ public final class CurrencyConverter extends AbstractModule {
if (Utils.isValidString(sender) && Utils.isValidString(query)) {
if (query.matches("\\d+([,\\d]+)?(\\.\\d+)? [a-zA-Z]{3}+ to [a-zA-Z]{3}+")) {
try {
final Message msg = converyCurrency(query.substring(query.indexOf(' ')));
final Message msg = convertCurrency(query);
if (msg.isError()) {
helpResponse(bot, sender, CURRENCY_CMD + ' ' + query, true);
}