mirror of
https://github.com/google/nomulus
synced 2026-01-03 11:45:39 +00:00
Add a simple toString for TimedTransitionProperty (#2604)
this means that we can actually see the transitions when running GetAllocationTokenCommand, for instance
This commit is contained in:
@@ -185,4 +185,9 @@ public class TimedTransitionProperty<V extends Serializable> implements UnsafeSe
|
||||
public int hashCode() {
|
||||
return this.backingMap.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.backingMap.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,8 +25,12 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import com.beust.jcommander.ParameterException;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableSortedMap;
|
||||
import google.registry.model.domain.Domain;
|
||||
import google.registry.model.domain.fee.FeeQueryCommandExtensionItem;
|
||||
import google.registry.model.domain.token.AllocationToken;
|
||||
import google.registry.util.DateTimeUtils;
|
||||
import org.joda.time.DateTime;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@@ -41,10 +45,49 @@ class GetAllocationTokenCommandTest extends CommandTestCase<GetAllocationTokenCo
|
||||
new AllocationToken.Builder()
|
||||
.setToken("foo")
|
||||
.setTokenType(SINGLE_USE)
|
||||
.setAllowedEppActions(
|
||||
ImmutableSet.of(FeeQueryCommandExtensionItem.CommandName.CREATE))
|
||||
.setAllowedRegistrarIds(ImmutableSet.of("TheRegistrar"))
|
||||
.setAllowedTlds(ImmutableSet.of("bar"))
|
||||
.setDiscountFraction(0.5)
|
||||
.setDiscountYears(2)
|
||||
.setTokenStatusTransitions(
|
||||
ImmutableSortedMap.of(
|
||||
DateTimeUtils.START_OF_TIME,
|
||||
AllocationToken.TokenStatus.NOT_STARTED,
|
||||
fakeClock.nowUtc(),
|
||||
AllocationToken.TokenStatus.VALID))
|
||||
.setDomainName("foo.bar")
|
||||
.build());
|
||||
runCommand("foo");
|
||||
assertInStdout(token.toString(), "Token foo was not redeemed.");
|
||||
assertStdoutIs(
|
||||
"""
|
||||
AllocationToken: {
|
||||
allowedClientIds=[TheRegistrar]
|
||||
allowedEppActions=[CREATE]
|
||||
allowedTlds=[bar]
|
||||
creationTime=CreateAutoTimestamp: {
|
||||
creationTime=2022-09-01T00:00:00.000Z
|
||||
}
|
||||
discountFraction=0.5
|
||||
discountPremiums=false
|
||||
discountPrice=null
|
||||
discountYears=2
|
||||
domainName=foo.bar
|
||||
redemptionHistoryId=null
|
||||
registrationBehavior=DEFAULT
|
||||
renewalPrice=null
|
||||
renewalPriceBehavior=DEFAULT
|
||||
token=foo
|
||||
tokenStatusTransitions={1970-01-01T00:00:00.000Z=NOT_STARTED, 2022-09-01T00:00:00.000Z=VALID}
|
||||
tokenType=SINGLE_USE
|
||||
updateTimestamp=UpdateAutoTimestamp: {
|
||||
lastUpdateTime=2022-09-01T00:00:00.000Z
|
||||
}
|
||||
}
|
||||
Token foo was not redeemed.
|
||||
|
||||
""");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user