3030import com .fasterxml .jackson .dataformat .xml .XmlMapper ;
3131import com .fasterxml .jackson .datatype .jsr310 .JavaTimeModule ;
3232import com .google .api .client .http .HttpResponseException ;
33+ import com .google .api .gax .rpc .FixedHeaderProvider ;
3334import com .google .cloud .storage .FakeHttpServer .HttpRequestHandler ;
3435import com .google .cloud .storage .it .ChecksummedTestContent ;
3536import com .google .cloud .storage .it .runner .StorageITRunner ;
6162import io .grpc .netty .shaded .io .netty .handler .codec .http .DefaultFullHttpResponse ;
6263import io .grpc .netty .shaded .io .netty .handler .codec .http .FullHttpRequest ;
6364import io .grpc .netty .shaded .io .netty .handler .codec .http .FullHttpResponse ;
64- import com .google .api .gax .rpc .FixedHeaderProvider ;
6565import io .grpc .netty .shaded .io .netty .handler .codec .http .HttpResponseStatus ;
6666import java .nio .ByteBuffer ;
6767import java .nio .charset .StandardCharsets ;
@@ -141,12 +141,14 @@ public void sendCreateMultipartUploadRequest_success() throws Exception {
141141 public void createFrom_withExistingUserAgent () throws Exception {
142142 HttpRequestHandler handler =
143143 req -> {
144- boolean hasCustom = req .headers ().getAll ("User-Agent" ).stream ()
145- .anyMatch (agent -> agent .contains ("my-custom-agent" ));
144+ boolean hasCustom =
145+ req .headers ().getAll ("User-Agent" ).stream ()
146+ .anyMatch (agent -> agent .contains ("my-custom-agent" ));
146147 assertThat (hasCustom ).isTrue ();
147148 // check that it does not also contain the gcloud-java generated header
148- boolean hasDefault = req .headers ().getAll ("User-Agent" ).stream ()
149- .anyMatch (agent -> agent .contains ("gcloud-java/" ));
149+ boolean hasDefault =
150+ req .headers ().getAll ("User-Agent" ).stream ()
151+ .anyMatch (agent -> agent .contains ("gcloud-java/" ));
150152 assertThat (hasDefault ).isFalse ();
151153
152154 CreateMultipartUploadResponse response =
@@ -166,7 +168,8 @@ public void createFrom_withExistingUserAgent() throws Exception {
166168 try (FakeHttpServer fakeHttpServer = FakeHttpServer .of (handler )) {
167169 HttpStorageOptions options =
168170 fakeHttpServer .getHttpStorageOptions ().toBuilder ()
169- .setHeaderProvider (FixedHeaderProvider .create (ImmutableMap .of ("User-Agent" , "my-custom-agent" )))
171+ .setHeaderProvider (
172+ FixedHeaderProvider .create (ImmutableMap .of ("User-Agent" , "my-custom-agent" )))
170173 .build ();
171174
172175 MultipartUploadHttpRequestManager multipartUploadHttpRequestManager =
@@ -186,8 +189,9 @@ public void createFrom_withExistingUserAgent() throws Exception {
186189 public void createFrom_withoutExistingUserAgent () throws Exception {
187190 HttpRequestHandler handler =
188191 req -> {
189- boolean hasDefault = req .headers ().getAll ("User-Agent" ).stream ()
190- .anyMatch (agent -> agent .startsWith ("gcloud-java/" ));
192+ boolean hasDefault =
193+ req .headers ().getAll ("User-Agent" ).stream ()
194+ .anyMatch (agent -> agent .startsWith ("gcloud-java/" ));
191195 assertThat (hasDefault ).isTrue ();
192196
193197 CreateMultipartUploadResponse response =
0 commit comments