Use method references instead of lambdas when possible

The assertThrows/expectThrows refactoring script does not use method
references, apparently.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179089048
This commit is contained in:
mcilwain 2017-12-14 13:40:15 -08:00 committed by Ben McIlwain
parent e619ea1bff
commit fbe11ff33c
35 changed files with 483 additions and 483 deletions

View file

@ -293,63 +293,63 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
public void testFailure_refundableFee_v06() throws Exception {
setEppInput("domain_renew_fee_refundable.xml", FEE_06_MAP);
persistDomain();
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow());
assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
}
@Test
public void testFailure_refundableFee_v11() throws Exception {
setEppInput("domain_renew_fee_refundable.xml", FEE_11_MAP);
persistDomain();
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow());
assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
}
@Test
public void testFailure_refundableFee_v12() throws Exception {
setEppInput("domain_renew_fee_refundable.xml", FEE_12_MAP);
persistDomain();
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow());
assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
}
@Test
public void testFailure_gracePeriodFee_v06() throws Exception {
setEppInput("domain_renew_fee_grace_period.xml", FEE_06_MAP);
persistDomain();
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow());
assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
}
@Test
public void testFailure_gracePeriodFee_v11() throws Exception {
setEppInput("domain_renew_fee_grace_period.xml", FEE_11_MAP);
persistDomain();
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow());
assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
}
@Test
public void testFailure_gracePeriodFee_v12() throws Exception {
setEppInput("domain_renew_fee_grace_period.xml", FEE_12_MAP);
persistDomain();
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow());
assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
}
@Test
public void testFailure_appliedFee_v06() throws Exception {
setEppInput("domain_renew_fee_applied.xml", FEE_06_MAP);
persistDomain();
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow());
assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
}
@Test
public void testFailure_appliedFee_v11() throws Exception {
setEppInput("domain_renew_fee_applied.xml", FEE_11_MAP);
persistDomain();
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow());
assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
}
@Test
public void testFailure_appliedFee_v12() throws Exception {
setEppInput("domain_renew_fee_applied.xml", FEE_12_MAP);
persistDomain();
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow());
assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
}
@Test
@ -404,7 +404,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
@Test
public void testFailure_neverExisted() throws Exception {
ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, () -> runFlow());
expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
}
@ -412,7 +412,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
public void testFailure_existedButWasDeleted() throws Exception {
persistDeletedDomain(getUniqueIdFromCommand(), clock.nowUtc().minusDays(1));
ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, () -> runFlow());
expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
}
@ -420,7 +420,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
public void testFailure_clientRenewProhibited() throws Exception {
persistDomain(StatusValue.CLIENT_RENEW_PROHIBITED);
ResourceStatusProhibitsOperationException thrown =
expectThrows(ResourceStatusProhibitsOperationException.class, () -> runFlow());
expectThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("clientRenewProhibited");
}
@ -428,7 +428,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
public void testFailure_serverRenewProhibited() throws Exception {
persistDomain(StatusValue.SERVER_RENEW_PROHIBITED);
ResourceStatusProhibitsOperationException thrown =
expectThrows(ResourceStatusProhibitsOperationException.class, () -> runFlow());
expectThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("serverRenewProhibited");
}
@ -440,7 +440,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
.addStatusValue(StatusValue.PENDING_DELETE)
.build());
ResourceStatusProhibitsOperationException thrown =
expectThrows(ResourceStatusProhibitsOperationException.class, () -> runFlow());
expectThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("pendingDelete");
}
@ -453,7 +453,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
.setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20)))
.build());
persistDomain();
assertThrows(FeesMismatchException.class, () -> runFlow());
assertThrows(FeesMismatchException.class, this::runFlow);
}
@Test
@ -465,7 +465,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
.setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20)))
.build());
persistDomain();
assertThrows(FeesMismatchException.class, () -> runFlow());
assertThrows(FeesMismatchException.class, this::runFlow);
}
@Test
@ -477,7 +477,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
.setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20)))
.build());
persistDomain();
assertThrows(FeesMismatchException.class, () -> runFlow());
assertThrows(FeesMismatchException.class, this::runFlow);
}
@Test
@ -494,7 +494,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
.setServerStatusChangeBillingCost(Money.of(EUR, 19))
.build());
persistDomain();
assertThrows(CurrencyUnitMismatchException.class, () -> runFlow());
assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
}
@Test
@ -511,7 +511,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
.setServerStatusChangeBillingCost(Money.of(EUR, 19))
.build());
persistDomain();
assertThrows(CurrencyUnitMismatchException.class, () -> runFlow());
assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
}
@Test
@ -528,28 +528,28 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
.setServerStatusChangeBillingCost(Money.of(EUR, 19))
.build());
persistDomain();
assertThrows(CurrencyUnitMismatchException.class, () -> runFlow());
assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
}
@Test
public void testFailure_feeGivenInWrongScale_v06() throws Exception {
setEppInput("domain_renew_fee_bad_scale.xml", FEE_06_MAP);
persistDomain();
assertThrows(CurrencyValueScaleException.class, () -> runFlow());
assertThrows(CurrencyValueScaleException.class, this::runFlow);
}
@Test
public void testFailure_feeGivenInWrongScale_v11() throws Exception {
setEppInput("domain_renew_fee_bad_scale.xml", FEE_11_MAP);
persistDomain();
assertThrows(CurrencyValueScaleException.class, () -> runFlow());
assertThrows(CurrencyValueScaleException.class, this::runFlow);
}
@Test
public void testFailure_feeGivenInWrongScale_v12() throws Exception {
setEppInput("domain_renew_fee_bad_scale.xml", FEE_12_MAP);
persistDomain();
assertThrows(CurrencyValueScaleException.class, () -> runFlow());
assertThrows(CurrencyValueScaleException.class, this::runFlow);
}
@Test
@ -560,7 +560,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
.setRegistrationExpirationTime(DateTime.parse("2001-09-08T22:00:00.0Z"))
.build());
ResourceStatusProhibitsOperationException thrown =
expectThrows(ResourceStatusProhibitsOperationException.class, () -> runFlow());
expectThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("pendingTransfer");
}
@ -568,14 +568,14 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
public void testFailure_periodInMonths() throws Exception {
setEppInput("domain_renew_months.xml");
persistDomain();
assertThrows(BadPeriodUnitException.class, () -> runFlow());
assertThrows(BadPeriodUnitException.class, this::runFlow);
}
@Test
public void testFailure_max10Years() throws Exception {
setEppInput("domain_renew_11_years.xml");
persistDomain();
assertThrows(ExceedsMaxRegistrationYearsException.class, () -> runFlow());
assertThrows(ExceedsMaxRegistrationYearsException.class, this::runFlow);
}
@Test
@ -585,14 +585,14 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
persistResource(reloadResourceByForeignKey().asBuilder()
.setRegistrationExpirationTime(DateTime.parse("2000-04-04T22:00:00.0Z"))
.build());
assertThrows(IncorrectCurrentExpirationDateException.class, () -> runFlow());
assertThrows(IncorrectCurrentExpirationDateException.class, this::runFlow);
}
@Test
public void testFailure_unauthorizedClient() throws Exception {
sessionMetadata.setClientId("NewRegistrar");
persistActiveDomain(getUniqueIdFromCommand());
assertThrows(ResourceNotOwnedException.class, () -> runFlow());
assertThrows(ResourceNotOwnedException.class, this::runFlow);
}
@Test
@ -608,7 +608,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
persistResource(
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
persistDomain();
assertThrows(NotAuthorizedForTldException.class, () -> runFlow());
assertThrows(NotAuthorizedForTldException.class, this::runFlow);
}
@Test
@ -626,7 +626,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
persistResource(Registry.get("example").asBuilder().setPremiumPriceAckRequired(true).build());
setEppInput("domain_renew_premium.xml");
persistDomain();
assertThrows(FeesRequiredForPremiumNameException.class, () -> runFlow());
assertThrows(FeesRequiredForPremiumNameException.class, this::runFlow);
}
@Test