2525
2626import com .beust .jcommander .ParameterException ;
2727import com .google .common .collect .ImmutableList ;
28+ import com .google .common .collect .ImmutableSet ;
29+ import com .google .common .collect .ImmutableSortedMap ;
2830import google .registry .model .domain .Domain ;
31+ import google .registry .model .domain .fee .FeeQueryCommandExtensionItem ;
2932import google .registry .model .domain .token .AllocationToken ;
33+ import google .registry .util .DateTimeUtils ;
3034import org .joda .time .DateTime ;
3135import org .junit .jupiter .api .Test ;
3236
@@ -41,10 +45,49 @@ void testSuccess_oneToken() throws Exception {
4145 new AllocationToken .Builder ()
4246 .setToken ("foo" )
4347 .setTokenType (SINGLE_USE )
48+ .setAllowedEppActions (
49+ ImmutableSet .of (FeeQueryCommandExtensionItem .CommandName .CREATE ))
50+ .setAllowedRegistrarIds (ImmutableSet .of ("TheRegistrar" ))
51+ .setAllowedTlds (ImmutableSet .of ("bar" ))
52+ .setDiscountFraction (0.5 )
53+ .setDiscountYears (2 )
54+ .setTokenStatusTransitions (
55+ ImmutableSortedMap .of (
56+ DateTimeUtils .START_OF_TIME ,
57+ AllocationToken .TokenStatus .NOT_STARTED ,
58+ fakeClock .nowUtc (),
59+ AllocationToken .TokenStatus .VALID ))
4460 .setDomainName ("foo.bar" )
4561 .build ());
4662 runCommand ("foo" );
47- assertInStdout (token .toString (), "Token foo was not redeemed." );
63+ assertStdoutIs (
64+ """
65+ AllocationToken: {
66+ allowedClientIds=[TheRegistrar]
67+ allowedEppActions=[CREATE]
68+ allowedTlds=[bar]
69+ creationTime=CreateAutoTimestamp: {
70+ creationTime=2022-09-01T00:00:00.000Z
71+ }
72+ discountFraction=0.5
73+ discountPremiums=false
74+ discountPrice=null
75+ discountYears=2
76+ domainName=foo.bar
77+ redemptionHistoryId=null
78+ registrationBehavior=DEFAULT
79+ renewalPrice=null
80+ renewalPriceBehavior=DEFAULT
81+ token=foo
82+ tokenStatusTransitions={1970-01-01T00:00:00.000Z=NOT_STARTED, 2022-09-01T00:00:00.000Z=VALID}
83+ tokenType=SINGLE_USE
84+ updateTimestamp=UpdateAutoTimestamp: {
85+ lastUpdateTime=2022-09-01T00:00:00.000Z
86+ }
87+ }
88+ Token foo was not redeemed.
89+
90+ """ );
4891 }
4992
5093 @ Test
0 commit comments