use of uk.gov.pay.connector.gateway.PaymentGatewayName.SMARTPAY in project pay-connector by alphagov.
the class ClientFactoryIT method shouldUseGatewaySpecificReadTimeoutOverrideForSmartpay_whenSpecified.
@Test
public void shouldUseGatewaySpecificReadTimeoutOverrideForSmartpay_whenSpecified() {
app = startApp("config/client-factory-test-config-with-smartpay-timeout-override.yaml", false);
when(mockMetricRegistry.register(any(), any())).thenReturn(null);
String path = "/hello";
wireMockRule.stubFor(get(urlPathEqualTo("/hello")).willReturn(aResponse().withBody("world").withStatus(200).withFixedDelay(2000)));
Client client = new ClientFactory(app.getEnvironment(), app.getConfiguration()).createWithDropwizardClient(SMARTPAY, AUTHORISE, mockMetricRegistry);
Invocation.Builder request = client.target(getServerUrl()).path(path).request();
Long authOverriddenTimeout = app.getConfiguration().getSmartpayConfig().getJerseyClientOverrides().map(override -> override.getAuth().getReadTimeout().toMicroseconds()).orElse(0L);
assertGatewayFailure(request, authOverriddenTimeout);
}
Aggregations