Example usage for org.springframework.web.client RestTemplate getErrorHandler

List of usage examples for org.springframework.web.client RestTemplate getErrorHandler

Introduction

In this page you can find the example usage for org.springframework.web.client RestTemplate getErrorHandler.

Prototype

public ResponseErrorHandler getErrorHandler() 

Source Link

Document

Return the error handler.

Usage

From source file:guru.nidi.ramltester.spring.RamlRestTemplate.java

private void init(RestTemplate restTemplate) {
    setErrorHandler(restTemplate.getErrorHandler());
    setMessageConverters(restTemplate.getMessageConverters());
}

From source file:io.spring.initializr.web.autoconfigure.InitializrAutoConfigurationTests.java

@Test
public void customRestTemplateBuilderIsUsed() {
    this.contextRunner.withUserConfiguration(CustomRestTemplateConfiguration.class).run((context) -> {
        assertThat(context).hasSingleBean(InitializrMetadataProvider.class);
        RestTemplate restTemplate = (RestTemplate) new DirectFieldAccessor(
                context.getBean(InitializrMetadataProvider.class)).getPropertyValue("restTemplate");
        assertThat(restTemplate.getErrorHandler()).isSameAs(CustomRestTemplateConfiguration.errorHandler);
    });//w  ww  . ja va  2 s .  c  o  m
}

From source file:io.spring.initializr.actuate.autoconfigure.InitializrStatsAutoConfigurationTests.java

@Test
public void customRestTemplateBuilderIsUsed() {
    this.contextRunner.withUserConfiguration(CustomRestTemplateConfiguration.class)
            .withPropertyValues("initializr.stats.elastic.uri=http://localhost:9200").run((context) -> {
                assertThat(context).hasSingleBean(ProjectGenerationStatPublisher.class);
                RestTemplate restTemplate = (RestTemplate) new DirectFieldAccessor(
                        context.getBean(ProjectGenerationStatPublisher.class)).getPropertyValue("restTemplate");
                assertThat(restTemplate.getErrorHandler())
                        .isSameAs(CustomRestTemplateConfiguration.errorHandler);
            });//from   w w w .  ja  v  a  2s  . c o m
}

From source file:org.springframework.cloud.dataflow.rest.client.DataflowTemplateTests.java

@Test
public void testThatPrepareRestTemplateWithNullContructorValueContainsMixins() {
    final RestTemplate restTemplate = DataFlowTemplate.prepareRestTemplate(null);

    assertNotNull(restTemplate);/*www.  j a  v a2s.c  om*/
    assertTrue(restTemplate.getErrorHandler() instanceof VndErrorResponseErrorHandler);

    assertCorrectMixins(restTemplate);

}

From source file:org.springframework.cloud.dataflow.rest.client.DataflowTemplateTests.java

@Test
public void testThatDefaultDataflowRestTemplateContainsMixins() {
    final RestTemplate restTemplate = DataFlowTemplate.getDefaultDataflowRestTemplate();

    assertNotNull(restTemplate);/*from  www  .  ja  v  a  2s .c o m*/
    assertTrue(restTemplate.getErrorHandler() instanceof VndErrorResponseErrorHandler);

    assertCorrectMixins(restTemplate);

}

From source file:org.springframework.cloud.dataflow.rest.client.DataflowTemplateTests.java

@Test
public void testThatPrepareRestTemplateWithProvidedRestTemplateContainsMixins() {
    final RestTemplate providedRestTemplate = new RestTemplate();
    final RestTemplate restTemplate = DataFlowTemplate.prepareRestTemplate(providedRestTemplate);

    assertNotNull(restTemplate);/*ww  w .j  av a2  s.  c o m*/
    assertTrue(providedRestTemplate == restTemplate);
    assertTrue(restTemplate.getErrorHandler() instanceof VndErrorResponseErrorHandler);

    assertCorrectMixins(restTemplate);
}

From source file:org.springframework.boot.web.client.RestTemplateBuilderTests.java

@Test
public void errorHandlerShouldApply() throws Exception {
    ResponseErrorHandler errorHandler = mock(ResponseErrorHandler.class);
    RestTemplate template = this.builder.errorHandler(errorHandler).build();
    assertThat(template.getErrorHandler()).isSameAs(errorHandler);
}