Validate EAP currency in Registry build

Verify that the currency of all entries in the EAP fee schedule map matches
that of the registry object itself.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=124967612
This commit is contained in:
mmuller 2016-06-15 10:43:23 -07:00 committed by Ben McIlwain
parent ec39f15a23
commit 5a4877805b
3 changed files with 30 additions and 8 deletions

View file

@ -434,4 +434,13 @@ public class RegistryTest extends EntityTestCase {
assertThat(registry.getEapFeeFor(clock.nowUtc().minusDays(2))).isEqualTo(Money.of(USD, 0));
assertThat(registry.getEapFeeFor(clock.nowUtc().plusDays(2))).isEqualTo(Money.of(USD, 50));
}
@Test
public void testFailure_eapFee_wrongCurrency() {
thrown.expect(
IllegalArgumentException.class, "All EAP fees must be in the registry's currency");
Registry.get("tld").asBuilder()
.setEapFeeSchedule(ImmutableSortedMap.of(START_OF_TIME, Money.zero(EUR)))
.build();
}
}