mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-17 16:39:29 +00:00
Update contribution
Closes gh-35698
This commit is contained in:
+1
-1
@@ -166,7 +166,7 @@ class DefaultRestTestClientBuilder<B extends RestTestClient.Builder<B>> implemen
|
||||
}
|
||||
|
||||
return new DefaultRestTestClient(
|
||||
this.restClientBuilder, this.entityResultConsumer, this);
|
||||
this.restClientBuilder, this.entityResultConsumer, new DefaultRestTestClientBuilder<>(this));
|
||||
}
|
||||
|
||||
|
||||
|
||||
+15
-4
@@ -20,13 +20,24 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link RestTestClient.Builder}.
|
||||
*/
|
||||
class DefaultRestTestClientBuilderTests {
|
||||
|
||||
@Test
|
||||
void testMutateHasNoSideEffects() {
|
||||
RestTestClient baseTestClient = new DefaultRestTestClientBuilder().baseUrl("http://localhost").build();
|
||||
baseTestClient.mutate().defaultHeader("foo", "bar").build();
|
||||
baseTestClient.mutate().defaultHeaders(headers -> assertThat(headers.containsHeader("foo")).isFalse());
|
||||
void mutateOriginalBuilderHasNoSideEffects() {
|
||||
RestTestClient.Builder<?> builder = new DefaultRestTestClientBuilder<>().baseUrl("http://localhost");
|
||||
RestTestClient client = builder.build();
|
||||
builder.defaultHeader("foo", "bar");
|
||||
client.mutate().defaultHeaders(headers -> assertThat(headers.containsHeader("foo")).isFalse());
|
||||
}
|
||||
|
||||
@Test
|
||||
void mutateSameClientTwiceHasNoSideEffects() {
|
||||
RestTestClient client = new DefaultRestTestClientBuilder<>().baseUrl("http://localhost").build();
|
||||
client.mutate().defaultHeader("foo", "bar").build();
|
||||
client.mutate().defaultHeaders(headers -> assertThat(headers.containsHeader("foo")).isFalse());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user