View Javadoc
1   /*
2    * Copyright 2024 Adrian Herscu
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package dev.aherscu.qa.testing.example.scenarios.tutorial6;
18  
19  import static dev.aherscu.qa.testing.utils.StreamMatchersExtensions.hasSpecificItems;
20  
21  import org.testng.annotations.*;
22  
23  import dev.aherscu.qa.jgiven.commons.utils.*;
24  import dev.aherscu.qa.jgiven.rest.model.*;
25  import dev.aherscu.qa.jgiven.rest.tags.*;
26  import dev.aherscu.qa.testing.utils.rest.*;
27  import dev.aherscu.qa.testing.example.*;
28  import dev.aherscu.qa.testing.example.model.tutorial.*;
29  import dev.aherscu.qa.testing.example.steps.tutorial.*;
30  import jakarta.ws.rs.client.*;
31  
32  @RestTest
33  @Ignore("does not work from github")
34  public class Binance extends
35      ConfigurableScenarioTest<TestConfiguration, RestScenarioType, BinanceFixtures<?>, BinanceActions<?>, BinanceVerifications<?>> {
36  
37      protected Binance() {
38          super(TestConfiguration.class);
39      }
40  
41      protected Client client;
42  
43      @AfterClass
44      protected void afterClassCloseRestClient() {
45          client.close();
46      }
47  
48      @BeforeClass
49      protected void beforeClassOpenRestClient() {
50          client = LoggingClientBuilder.newClient();
51      }
52  
53      @Test
54      public void shouldGetExchangeInfo() {
55          given()
56              .binance(client)
57              .with(configuration());
58  
59          when()
60              .doing_nothing();
61  
62          // ISSUE does not work from github's runners... returns with 451
63          // Service unavailable from a restricted location according to
64          // 'b. Eligibility' in https://www.binance.com/en/terms.
65          // Please contact customer service if you believe you received this message in
66          // error.
67          then()
68              .the_exchange_info(hasSpecificItems(Symbol.builder()
69                  .symbol("BTCUSDT")
70                  .baseAsset("BTC")
71                  .contractType("PERPETUAL")
72                  .build()));
73      }
74  }