@Test(dataProvider = "name") public void test_name(PriceIndex convention, String name) { assertEquals(convention.getName(), name); }
private static ImmutableMap<String, PriceIndex> loadFromCsv() { List<ResourceLocator> resources = ResourceConfig.orderedResources("PriceIndexData.csv"); Map<String, PriceIndex> map = new HashMap<>(); // files are ordered lowest priority to highest, thus Map::put is used for (ResourceLocator resource : resources) { try { CsvFile csv = CsvFile.of(resource.getCharSource(), true); for (CsvRow row : csv.rows()) { PriceIndex parsed = parsePriceIndex(row); map.put(parsed.getName(), parsed); map.put(parsed.getName().toUpperCase(Locale.ENGLISH), parsed); } } catch (RuntimeException ex) { log.log(Level.SEVERE, "Error processing resource as Price Index CSV file: " + resource, ex); return ImmutableMap.of(); } } return ImmutableMap.copyOf(map); }
public void test_gbpHicp() { PriceIndex test = PriceIndex.of("GB-HICP"); assertEquals(test.getName(), "GB-HICP"); assertEquals(test.getCurrency(), GBP); assertEquals(test.getRegion(), GB); assertEquals(test.isActive(), true); assertEquals(test.getPublicationFrequency(), Frequency.P1M); assertEquals(test.getFloatingRateName(), FloatingRateName.of("GB-HICP")); assertEquals(test.toString(), "GB-HICP"); }
public void test_getFloatingRateName() { for (PriceIndex index : PriceIndex.extendedEnum().lookupAll().values()) { assertEquals(index.getFloatingRateName(), FloatingRateName.of(index.getName())); } }
InflationRateCalculation calc = (InflationRateCalculation) calculation; String gearing = calc.getGearing().map(g -> " * " + SummarizerUtils.value(g.getInitialValue())).orElse(""); return calc.getIndex().getName() + gearing;