BAEL-5054 fix indentations
This commit is contained in:
parent
82c3389ba0
commit
439848c165
@ -34,11 +34,11 @@ public class ReactiveUploadService {
|
|||||||
.contentType(MediaType.APPLICATION_PDF)
|
.contentType(MediaType.APPLICATION_PDF)
|
||||||
.body(BodyInserters.fromResource(resource))
|
.body(BodyInserters.fromResource(resource))
|
||||||
.exchangeToMono(response -> {
|
.exchangeToMono(response -> {
|
||||||
if (response.statusCode().equals(HttpStatus.OK)) {
|
if (response.statusCode().equals(HttpStatus.OK)) {
|
||||||
return response.bodyToMono(HttpStatus.class).thenReturn(response.statusCode());
|
return response.bodyToMono(HttpStatus.class).thenReturn(response.statusCode());
|
||||||
} else {
|
} else {
|
||||||
throw new ServiceException("Error uploading file");
|
throw new ServiceException("Error uploading file");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return httpStatusMono;
|
return httpStatusMono;
|
||||||
}
|
}
|
||||||
@ -55,11 +55,11 @@ public class ReactiveUploadService {
|
|||||||
.contentType(MediaType.MULTIPART_FORM_DATA)
|
.contentType(MediaType.MULTIPART_FORM_DATA)
|
||||||
.body(BodyInserters.fromMultipartData(builder.build()))
|
.body(BodyInserters.fromMultipartData(builder.build()))
|
||||||
.exchangeToMono(response -> {
|
.exchangeToMono(response -> {
|
||||||
if (response.statusCode().equals(HttpStatus.OK)) {
|
if (response.statusCode().equals(HttpStatus.OK)) {
|
||||||
return response.bodyToMono(HttpStatus.class).thenReturn(response.statusCode());
|
return response.bodyToMono(HttpStatus.class).thenReturn(response.statusCode());
|
||||||
} else {
|
} else {
|
||||||
throw new ServiceException("Error uploading file");
|
throw new ServiceException("Error uploading file");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return httpStatusMono;
|
return httpStatusMono;
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,8 @@ class ReactiveUploadServiceUnitTest {
|
|||||||
|
|
||||||
final WebClient webClientMock = WebClient.builder().baseUrl(BASE_URL)
|
final WebClient webClientMock = WebClient.builder().baseUrl(BASE_URL)
|
||||||
.exchangeFunction(clientRequest -> Mono.just(ClientResponse.create(HttpStatus.OK)
|
.exchangeFunction(clientRequest -> Mono.just(ClientResponse.create(HttpStatus.OK)
|
||||||
.header("content-type", "application/json")
|
.header("content-type", "application/json")
|
||||||
.build()))
|
.build()))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
private final ReactiveUploadService tested = new ReactiveUploadService(webClientMock);
|
private final ReactiveUploadService tested = new ReactiveUploadService(webClientMock);
|
||||||
@ -27,8 +27,10 @@ class ReactiveUploadServiceUnitTest {
|
|||||||
@Test
|
@Test
|
||||||
void givenAPdf_whenUploadingWithWebClient_thenOK() {
|
void givenAPdf_whenUploadingWithWebClient_thenOK() {
|
||||||
final Resource file = mock(Resource.class);
|
final Resource file = mock(Resource.class);
|
||||||
|
|
||||||
final Mono<HttpStatus> result = tested.uploadPdf(file);
|
final Mono<HttpStatus> result = tested.uploadPdf(file);
|
||||||
final HttpStatus status = result.block();
|
final HttpStatus status = result.block();
|
||||||
|
|
||||||
assertThat(status).isEqualTo(HttpStatus.OK);
|
assertThat(status).isEqualTo(HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,8 +39,10 @@ class ReactiveUploadServiceUnitTest {
|
|||||||
final Resource file = mock(Resource.class);
|
final Resource file = mock(Resource.class);
|
||||||
final MultipartFile multipartFile = mock(MultipartFile.class);
|
final MultipartFile multipartFile = mock(MultipartFile.class);
|
||||||
when(multipartFile.getResource()).thenReturn(file);
|
when(multipartFile.getResource()).thenReturn(file);
|
||||||
|
|
||||||
final Mono<HttpStatus> result = tested.uploadMultipart(multipartFile);
|
final Mono<HttpStatus> result = tested.uploadMultipart(multipartFile);
|
||||||
final HttpStatus status = result.block();
|
final HttpStatus status = result.block();
|
||||||
|
|
||||||
assertThat(status).isEqualTo(HttpStatus.OK);
|
assertThat(status).isEqualTo(HttpStatus.OK);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user