Skip to content
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

Merged
merged 9 commits into from Nov 21, 2017
Merged

Conversation

andreiruse
Copy link
Contributor

This will be a simple wrapper of a QuoteId and a double value.

A similar example is FxRate wrapping FxRateId and the actual rate.

*
* 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.
Copy link
Member

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>
*
Copy link
Member

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
Copy link
Member

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) {
Copy link
Member

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;
Copy link
Member

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"));
Copy link
Member

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);
}
}
Copy link
Member

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:.+")
Copy link
Member

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

@jodastephen jodastephen merged commit 935304b into master Nov 21, 2017
@jodastephen jodastephen deleted the topic/add-quote-object-type branch November 21, 2017 12:16
@jodastephen jodastephen added this to the v1.6 milestone Nov 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants