Clone RestTestClientBuilder in mutate()

See gh-35698

Signed-off-by: Thomas Recloux <trecloux@purse.eu>
This commit is contained in:
Thomas Recloux
2025-10-28 12:29:40 +01:00
committed by rstoyanchev
parent 183a9466c5
commit 8e046b8a3c
3 changed files with 34 additions and 2 deletions
@@ -132,7 +132,7 @@ class DefaultRestTestClient implements RestTestClient {
@SuppressWarnings("unchecked")
@Override
public <B extends Builder<B>> Builder<B> mutate() {
return (Builder<B>) this.restTestClientBuilder;
return new DefaultRestTestClientBuilder<>((DefaultRestTestClientBuilder<B>) this.restTestClientBuilder);
}
@@ -166,7 +166,7 @@ class DefaultRestTestClientBuilder<B extends RestTestClient.Builder<B>> implemen
}
return new DefaultRestTestClient(
this.restClientBuilder, this.entityResultConsumer, new DefaultRestTestClientBuilder<>(this));
this.restClientBuilder, this.entityResultConsumer, this);
}