本文整理汇总了Java中com.piggymetrics.statistics.domain.ExchangeRatesContainer类的典型用法代码示例。如果您正苦于以下问题:Java ExchangeRatesContainer类的具体用法?Java ExchangeRatesContainer怎么用?Java ExchangeRatesContainer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExchangeRatesContainer类属于com.piggymetrics.statistics.domain包,在下文中一共展示了ExchangeRatesContainer类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: shouldReturnCurrentRatesWhenContainerIsEmptySoFar
import com.piggymetrics.statistics.domain.ExchangeRatesContainer; //导入依赖的package包/类
@Test
public void shouldReturnCurrentRatesWhenContainerIsEmptySoFar() {
ExchangeRatesContainer container = new ExchangeRatesContainer();
container.setRates(ImmutableMap.of(
Currency.EUR.name(), new BigDecimal("0.8"),
Currency.RUB.name(), new BigDecimal("80")
));
when(client.getRates(Currency.getBase())).thenReturn(container);
Map<Currency, BigDecimal> result = ratesService.getCurrentRates();
verify(client, times(1)).getRates(Currency.getBase());
assertEquals(container.getRates().get(Currency.EUR.name()), result.get(Currency.EUR));
assertEquals(container.getRates().get(Currency.RUB.name()), result.get(Currency.RUB));
assertEquals(BigDecimal.ONE, result.get(Currency.USD));
}
开发者ID:sniperqpc,项目名称:Spring-cloud-gather,代码行数:19,代码来源:ExchangeRatesServiceImplTest.java
示例2: shouldNotRequestRatesWhenTodaysContainerAlreadyExists
import com.piggymetrics.statistics.domain.ExchangeRatesContainer; //导入依赖的package包/类
@Test
public void shouldNotRequestRatesWhenTodaysContainerAlreadyExists() {
ExchangeRatesContainer container = new ExchangeRatesContainer();
container.setRates(ImmutableMap.of(
Currency.EUR.name(), new BigDecimal("0.8"),
Currency.RUB.name(), new BigDecimal("80")
));
when(client.getRates(Currency.getBase())).thenReturn(container);
// initialize container
ratesService.getCurrentRates();
// use existing container
ratesService.getCurrentRates();
verify(client, times(1)).getRates(Currency.getBase());
}
开发者ID:sniperqpc,项目名称:Spring-cloud-gather,代码行数:20,代码来源:ExchangeRatesServiceImplTest.java
示例3: shouldConvertCurrency
import com.piggymetrics.statistics.domain.ExchangeRatesContainer; //导入依赖的package包/类
@Test
public void shouldConvertCurrency() {
ExchangeRatesContainer container = new ExchangeRatesContainer();
container.setRates(ImmutableMap.of(
Currency.EUR.name(), new BigDecimal("0.8"),
Currency.RUB.name(), new BigDecimal("80")
));
when(client.getRates(Currency.getBase())).thenReturn(container);
final BigDecimal amount = new BigDecimal(100);
final BigDecimal expectedConvertionResult = new BigDecimal("1.25");
BigDecimal result = ratesService.convert(Currency.RUB, Currency.USD, amount);
assertTrue(expectedConvertionResult.compareTo(result) == 0);
}
开发者ID:sniperqpc,项目名称:Spring-cloud-gather,代码行数:19,代码来源:ExchangeRatesServiceImplTest.java
示例4: shouldRetrieveExchangeRates
import com.piggymetrics.statistics.domain.ExchangeRatesContainer; //导入依赖的package包/类
@Test
public void shouldRetrieveExchangeRates() {
ExchangeRatesContainer container = client.getRates(Currency.getBase());
assertEquals(container.getDate(), LocalDate.now());
assertEquals(container.getBase(), Currency.getBase());
assertNotNull(container.getRates().get(Currency.EUR.name()));
assertNotNull(container.getRates().get(Currency.RUB.name()));
}
开发者ID:sniperqpc,项目名称:Spring-cloud-gather,代码行数:12,代码来源:ExchangeRatesClientTest.java
示例5: getRates
import com.piggymetrics.statistics.domain.ExchangeRatesContainer; //导入依赖的package包/类
@RequestMapping(method = RequestMethod.GET, value = "/latest")
ExchangeRatesContainer getRates(@RequestParam("base") Currency base);
开发者ID:sniperqpc,项目名称:Spring-cloud-gather,代码行数:3,代码来源:ExchangeRatesClient.java
注:本文中的com.piggymetrics.statistics.domain.ExchangeRatesContainer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论