@Test public void options() throws Exception { TestRestTemplate template = new TestRestTemplate( HttpClientOption.ENABLE_REDIRECTS); CustomHttpComponentsClientHttpRequestFactory factory = (CustomHttpComponentsClientHttpRequestFactory) template .getRestTemplate().getRequestFactory(); RequestConfig config = factory.getRequestConfig(); assertThat(config.isRedirectsEnabled()).isTrue(); }
@Test public void testHome() throws Exception { TestRestTemplate testRestTemplate = new TestRestTemplate(HttpClientOption.SSL); ResponseEntity<String> entity = testRestTemplate .getForEntity("https://localhost:" + this.port, String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(entity.getBody()).isEqualTo("Hello World"); }
@Test public void testHome() throws Exception { TestRestTemplate testRestTemplate = new TestRestTemplate(HttpClientOption.SSL); ResponseEntity<String> entity = testRestTemplate .getForEntity("https://localhost:" + this.port, String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(entity.getBody()).isEqualTo("Hello, world"); }
@Before public void setup() { clearData(); initData(); this.baseUrl = "http://localhost:" + port; this.restTemplate = new TestRestTemplate("admin", "test123", new HttpClientOption[]{}); }