Drop "get" prefix from Part accessor methods

This commit is contained in:
Rossen Stoyanchev
2017-05-04 09:27:59 -04:00
parent 4525c6a537
commit ac1db169a4
13 changed files with 73 additions and 73 deletions

View File

@@ -36,8 +36,6 @@ import reactor.test.StepVerifier;
import org.springframework.core.codec.ByteBufferDecoder;
import org.springframework.core.codec.StringDecoder;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.core.io.buffer.DefaultDataBuffer;
import org.springframework.core.io.buffer.DefaultDataBufferFactory;
@@ -56,7 +54,6 @@ import org.springframework.http.codec.xml.Jaxb2XmlDecoder;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.http.server.reactive.ServerHttpResponse;
import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest;
import org.springframework.util.FileCopyUtils;
import org.springframework.util.MultiValueMap;
import static org.junit.Assert.*;
@@ -297,24 +294,24 @@ public class BodyExtractorsTests {
StepVerifier.create(result)
.consumeNextWith(part -> {
assertEquals("text", part.getName());
assertEquals("text", part.name());
assertTrue(part instanceof FormFieldPart);
FormFieldPart formFieldPart = (FormFieldPart) part;
assertEquals("text default", formFieldPart.getValue());
assertEquals("text default", formFieldPart.value());
})
.consumeNextWith(part -> {
assertEquals("file1", part.getName());
assertEquals("file1", part.name());
assertTrue(part instanceof FilePart);
FilePart filePart = (FilePart) part;
assertEquals("a.txt", filePart.getFilename());
assertEquals(MediaType.TEXT_PLAIN, filePart.getHeaders().getContentType());
assertEquals("a.txt", filePart.filename());
assertEquals(MediaType.TEXT_PLAIN, filePart.headers().getContentType());
})
.consumeNextWith(part -> {
assertEquals("file2", part.getName());
assertEquals("file2", part.name());
assertTrue(part instanceof FilePart);
FilePart filePart = (FilePart) part;
assertEquals("a.html", filePart.getFilename());
assertEquals(MediaType.TEXT_HTML, filePart.getHeaders().getContentType());
assertEquals("a.html", filePart.filename());
assertEquals(MediaType.TEXT_HTML, filePart.headers().getContentType());
})
.expectComplete()
.verify();

View File

@@ -16,7 +16,6 @@
package org.springframework.web.reactive.function;
import java.util.List;
import java.util.Map;
import org.junit.Test;
@@ -106,8 +105,8 @@ public class MultipartIntegrationTests extends AbstractRouterFunctionIntegration
Map<String, Part> parts = map.toSingleValueMap();
try {
assertEquals(2, parts.size());
assertEquals("foo.txt", ((FilePart) parts.get("fooPart")).getFilename());
assertEquals("bar", ((FormFieldPart) parts.get("barPart")).getValue());
assertEquals("foo.txt", ((FilePart) parts.get("fooPart")).filename());
assertEquals("bar", ((FormFieldPart) parts.get("barPart")).value());
}
catch(Exception e) {
return Mono.error(e);
@@ -121,8 +120,8 @@ public class MultipartIntegrationTests extends AbstractRouterFunctionIntegration
.flatMap(parts -> {
try {
assertEquals(2, parts.size());
assertEquals("foo.txt", ((FilePart) parts.get(0)).getFilename());
assertEquals("bar", ((FormFieldPart) parts.get(1)).getValue());
assertEquals("foo.txt", ((FilePart) parts.get(0)).filename());
assertEquals("bar", ((FormFieldPart) parts.get(1)).value());
}
catch(Exception e) {
return Mono.error(e);

View File

@@ -155,8 +155,8 @@ public class MultipartIntegrationTests extends AbstractHttpHandlerIntegrationTes
@PostMapping("/requestPart")
void requestPart(@RequestPart FormFieldPart barPart, @RequestPart Mono<FilePart> fooPart) {
assertEquals("bar", barPart.getValue());
assertEquals("foo.txt", fooPart.block(Duration.ZERO).getFilename());
assertEquals("bar", barPart.value());
assertEquals("foo.txt", fooPart.block(Duration.ZERO).filename());
}
@PostMapping("/requestBodyMap")
@@ -167,7 +167,7 @@ public class MultipartIntegrationTests extends AbstractHttpHandlerIntegrationTes
@PostMapping("/requestBodyFlux")
Mono<String> requestBodyFlux(@RequestBody Flux<Part> parts) {
return parts.map(Part::getName).collectList()
return parts.map(Part::name).collectList()
.map(names -> names.stream().sorted().collect(Collectors.joining(",", "Flux[", "]")));
}
@@ -202,7 +202,7 @@ public class MultipartIntegrationTests extends AbstractHttpHandlerIntegrationTes
@Override
public String toString() {
return "TestBean[barPart=" + getBarPart() + ",fooPart=" + getFooPart().getFilename() + "]";
return "TestBean[barPart=" + getBarPart() + ",fooPart=" + getFooPart().filename() + "]";
}
}