Merge branch '5.3.x' into main

This commit is contained in:
rstoyanchev
2022-03-16 09:27:43 +00:00
10 changed files with 163 additions and 101 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -128,6 +128,15 @@ class ResponseCreatorsTests {
assertThat(StreamUtils.copyToByteArray(response.getBody()).length).isEqualTo(0);
}
@Test
void withCustomStatus() throws Exception {
DefaultResponseCreator responseCreator = MockRestResponseCreators.withRawStatus(454);
MockClientHttpResponse response = (MockClientHttpResponse) responseCreator.createResponse(null);
assertThat(response.getRawStatusCode()).isEqualTo(454);
assertThat(response.getStatusText()).isEmpty();
}
@Test
void withException() {
ResponseCreator responseCreator = MockRestResponseCreators.withException(new SocketTimeoutException());