use of org.springframework.util.MultiValueMap in project geode by apache.
the class ClientHttpRequestJUnitTest method testCreateRequestEntityOnPut.
@Test
public void testCreateRequestEntityOnPut() throws Exception {
final Book mockBook = mockContext.mock(Book.class, "testCreateRequestEntityOnPut.Book");
final Link expectedLink = new Link("put", toUri("http://host.domain.com:8080/app/libraries/{name}/books/{id}"), HttpMethod.PUT);
final ClientHttpRequest request = new ClientHttpRequest(expectedLink);
assertEquals(expectedLink, request.getLink());
assertTrue(request.isPut());
assertNull(request.getContent());
request.setContent(mockBook);
request.addParameterValues("isbn", "0-123456789");
request.addParameterValues("category", "science-fiction", "sci-fi", "fiction");
assertSame(mockBook, request.getContent());
assertEquals("0-123456789", request.getParameterValue("isbn"));
assertTrue(request.getParameterValues("category").containsAll(Arrays.asList("science-fiction", "sci-fi", "fiction")));
final HttpEntity<?> requestEntity = request.createRequestEntity();
assertNotNull(requestEntity);
assertTrue(requestEntity.getBody() instanceof MultiValueMap);
assertEquals(MediaType.APPLICATION_FORM_URLENCODED, requestEntity.getHeaders().getContentType());
}
Aggregations