New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding Quote object and unit test #1611
Conversation
* | ||
* This represents a single numeric value of a given security, such as the mid point between the buy/sell. | ||
* <p> | ||
* See {@link QuoteId} fot the representation that does not contain a value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fot -> for, although I'm not sure this line is adding anything, so best to remove
/** | ||
* A single value for a given security, represented by a quote, such as 'EUR/GBP 1W FX Opt ATM Straddle' - 10.0. | ||
* <p> | ||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No blank line
/** | ||
* Obtains an instance from a the scheme ID, quote ID, and value. | ||
* | ||
* @param identifierScheme the identifier of the scheme used to indicate the quote |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Strata there are two spaces after the parameter name, so @param xxx<two spaces here>description
* @return an instance of {@link Quote} for the given values | ||
* @throws IllegalArgumentException if the scheme ID, or scheme value are empty | ||
*/ | ||
public static Quote of(String identifierScheme, String identifier, Double value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be double
, not Double
.
* The value applicable for the given {@link QuoteId}. | ||
*/ | ||
@PropertyDefinition(validate = "notNull") | ||
private final Double value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be double
not Double
|
||
@Test | ||
public class QuoteTest { | ||
private static final QuoteId quoteId1 = QuoteId.of(StandardId.of("og", "id1")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
constants should be upper case quoteId1
-> QUOTE_ID1
public void test_of_EmptyId() throws Exception { | ||
Quote.of("notEmpty", "", 1.2345); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new line EOF
Quote.of("", "notEmpty", 1.2345); | ||
} | ||
|
||
@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "Argument 'value' with value '' must match pattern:.+") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strata uses assertThrowsIllegalArg(lambda, regex)
for cases like these. Both error cases can then be in one method
This will be a simple wrapper of a
QuoteId
and a double value.A similar example is
FxRate
wrappingFxRateId
and the actual rate.