本文整理汇总了Java中org.threeten.bp.OffsetDateTime.toLocalDate方法的典型用法代码示例。如果您正苦于以下问题:Java OffsetDateTime.toLocalDate方法的具体用法?Java OffsetDateTime.toLocalDate怎么用?Java OffsetDateTime.toLocalDate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.threeten.bp.OffsetDateTime
的用法示例。
在下文中一共展示了OffsetDateTime.toLocalDate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test_resolve_trade
import org.threeten.bp.OffsetDateTime; //导入方法依赖的package包/类
public void test_resolve_trade() {
final OffsetDateTime now = OffsetDateTime.now();
final InMemorySecuritySource secSource = new InMemorySecuritySource();
final MockPositionSource posSource = new MockPositionSource();
final SimplePortfolio portfolio = new SimplePortfolio(UniqueId.of("Test", "1"), "Name");
final SimplePosition position = new SimplePosition(UniqueId.of("Test", "1"), new BigDecimal(1), ExternalIdBundle.EMPTY);
final SimpleTrade trade = new SimpleTrade(new SimpleSecurityLink(), new BigDecimal(1), new SimpleCounterparty(ExternalId.of("CPARTY", "C100")), now.toLocalDate(), now.toOffsetTime());
trade.setUniqueId(UniqueId.of("TradeScheme", "1"));
position.addTrade(trade);
portfolio.getRootNode().addPosition(position);
posSource.addPortfolio(portfolio);
final DefaultComputationTargetResolver test = new DefaultComputationTargetResolver(secSource, posSource);
final ComputationTargetSpecification spec = ComputationTargetSpecification.of(trade);
final ComputationTarget expected = new ComputationTarget(ComputationTargetType.TRADE, trade);
assertExpected(expected, test.resolve(spec, VersionCorrection.LATEST));
}
示例2: test_getTrade
import org.threeten.bp.OffsetDateTime; //导入方法依赖的package包/类
public void test_getTrade() throws Exception {
final PortfolioMaster mockPortfolio = mock(PortfolioMaster.class);
final PositionMaster mockPosition = mock(PositionMaster.class);
final OffsetDateTime now = OffsetDateTime.now();
final ManageableTrade doc = new ManageableTrade(BigDecimal.TEN, ExternalId.of("B", "C"), now.toLocalDate(), now.toOffsetTime().minusSeconds(100), ExternalId.of("CPARTY", "C100"));
doc.setUniqueId(UID);
when(mockPosition.getTrade(UID)).thenReturn(doc);
MasterPositionSource test = new MasterPositionSource(mockPortfolio, mockPosition);
Trade testResult = test.getTrade(UID);
verify(mockPosition, times(1)).getTrade(UID);
assertEquals(UID, testResult.getUniqueId());
assertEquals(BigDecimal.TEN, testResult.getQuantity());
assertEquals(ExternalId.of("B", "C").toBundle(), testResult.getSecurityLink().getExternalId());
}
示例3: of
import org.threeten.bp.OffsetDateTime; //导入方法依赖的package包/类
/**
* Obtains a flexi date-time, specifying the offset date-time.
* <p>
* This factory is strict and requires the date-time.
*
* @param dateTime the date-time, not null
* @return the date-time, not null
*/
public static FlexiDateTime of(OffsetDateTime dateTime) {
ArgumentChecker.notNull(dateTime, "dateTime");
return new FlexiDateTime(dateTime.toLocalDate(), dateTime.toLocalTime(), dateTime.getOffset());
}