Don't allow package tokens to discount premium names (#1804)

This commit is contained in:
sarahcaseybot
2022-10-03 14:27:10 -04:00
committed by GitHub
parent cca1306b09
commit 8c5d2e9d92
2 changed files with 15 additions and 0 deletions
@@ -228,6 +228,18 @@ public class AllocationTokenTest extends EntityTestCase {
.isEqualTo("Package tokens must have renewalPriceBehavior set to SPECIFIED");
}
@Test
void testFail_packageTokenDiscountPremium() {
AllocationToken.Builder builder =
new AllocationToken.Builder()
.setToken("abc123")
.setTokenType(TokenType.PACKAGE)
.setRenewalPriceBehavior(RenewalPriceBehavior.SPECIFIED)
.setDiscountPremiums(true);
IllegalArgumentException thrown = assertThrows(IllegalArgumentException.class, builder::build);
assertThat(thrown).hasMessageThat().isEqualTo("Package tokens cannot discount premium names");
}
@Test
void testBuild_DomainNameWithLessThanTwoParts() {
IllegalArgumentException thrown =