Merge pull request #7386 from thecockatiel/fix_misc

fix: some issues in EditOfferOptionParser
This commit is contained in:
Alejandro García 2025-02-10 00:45:22 +00:00 committed by GitHub
commit 631d0f9222
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 7 deletions

View file

@ -123,11 +123,9 @@ public class EditOfferOptionParser extends OfferIdOptionParser implements Method
if (options.has(mktPriceMarginPctOpt)) {
if (valueNotSpecified.test(mktPriceMarginPctOpt))
throw new IllegalArgumentException("no mkt price margin specified");
throw new IllegalArgumentException("no market price margin specified");
String priceMarginPctAsString = options.valueOf(mktPriceMarginPctOpt);
if (priceMarginPctAsString.isEmpty())
throw new IllegalArgumentException("no market price margin specified");
verifyStringIsValidDouble(priceMarginPctAsString);
@ -140,6 +138,7 @@ public class EditOfferOptionParser extends OfferIdOptionParser implements Method
}
boolean mktPriceMarginOptAndEnableOptAreOnlyOpts = options.has(enableOpt)
&& !options.has(fixedPriceOpt)
&& !options.has(triggerPriceOpt);
if (mktPriceMarginOptAndEnableOptAreOnlyOpts) {
offerEditType = MKT_PRICE_MARGIN_AND_ACTIVATION_STATE;
@ -151,9 +150,7 @@ public class EditOfferOptionParser extends OfferIdOptionParser implements Method
if (valueNotSpecified.test(triggerPriceOpt))
throw new IllegalArgumentException("no trigger price specified");
String triggerPriceAsString = options.valueOf(fixedPriceOpt);
if (triggerPriceAsString.isEmpty())
throw new IllegalArgumentException("trigger price not specified");
String triggerPriceAsString = options.valueOf(triggerPriceOpt);
verifyStringIsValidDouble(triggerPriceAsString);

View file

@ -217,7 +217,7 @@ public class EditOfferOptionParserTest {
};
Throwable exception = assertThrows(RuntimeException.class, () ->
new EditOfferOptionParser(args).parse());
assertEquals("no mkt price margin specified",
assertEquals("no market price margin specified",
exception.getMessage());
}