Весеннее загрузочное приложение с огурцом с использованием Rest Template - PullRequest
0 голосов
/ 20 февраля 2020
**Exception** 
I/O error on GET request for "http://localhost:8090/hello": Connection refused: connect; nested exception is java.net.ConnectException: Connection refused: connect

**Feature file**
Given Checking for the page "http://localhost:8090/hello"

**Stepdefinition**
@Autowired
    RestTemplate restTemplate;

@Given("^Checking for the page \"([^\"]*)\"$")
    public void checking_for_the_page_http_localhost_customer(String url) {
            this.url = url;
            restTemplate = new RestTemplate();
        ResponseEntity<String> response = restTemplate.getForEntity(this.url, String.class);
        Assert.assertEquals(200, response.getStatusCode());
    }

Пояснение Я использую RestTemplate для получения ответа от URL, который упоминается в файле возможностей. Это передается функции в файле класса stepdefinition.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...