View Javadoc
1   /*
2    * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko
3    * SPDX-License-Identifier: MIT
4    */
5   package com.jcabi.http.wire;
6   
7   import com.jcabi.http.request.JdkRequest;
8   import com.jcabi.http.response.XmlResponse;
9   import java.io.IOException;
10  import org.hamcrest.MatcherAssert;
11  import org.hamcrest.Matchers;
12  import org.junit.jupiter.api.Test;
13  
14  /**
15   * Integration case for {@link BasicAuthWire}.
16   *
17   * @since 1.17.4
18   */
19  final class BasicAuthWireITCase {
20      @Test
21      void basicAuthWorks() throws IOException {
22          final XmlResponse res = new JdkRequest(
23              "https://User:Pass@authenticationtest.com/HTTPAuth/"
24          )
25              .through(BasicAuthWire.class)
26              .through(AutoRedirectingWire.class)
27              .fetch()
28              .as(XmlResponse.class);
29          MatcherAssert.assertThat(
30              "should be success",
31              res.body(),
32              Matchers.containsString("Success!")
33          );
34      }
35  }