/*
 * (C) Copyright 2017 Boni Garcia (http://bonigarcia.github.io/)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
package io.github.bonigarcia;

import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.equalTo;

import org.junit.jupiter.api.Test;

public class PublicRestServicesTest {

    @Test
    void testEchoService() {
        String key = "foo";
        String value = "bar";
        given().when().get("http://echo.jsontest.com/" + key + "/" + value)
                .then().assertThat().statusCode(200).body(key, equalTo(value));
    }

    @Test
    void testCountryService() {
        given().when()
                .get("http://services.groupkt.com/country/get/iso2code/ES")
                .then().assertThat().statusCode(200)
                .body("RestResponse.result.name", equalTo("Spain"));
    }

}

@@ -1,10 +1,11 @@
 /*
+%0D
 %0A * (C) 
@@ -61,19 +61,21 @@
 hub.io/)
+%0D
 %0A *
+%0D
 %0A * Lice
@@ -133,16 +133,17 @@
 cense%22);
+%0D
 %0A * you 
@@ -202,16 +202,17 @@
 License.
+%0D
 %0A * You 
@@ -246,19 +246,21 @@
 cense at
+%0D
 %0A *
+%0D
 %0A *   ht
@@ -299,19 +299,21 @@
 ENSE-2.0
+%0D
 %0A *
+%0D
 %0A * Unle
@@ -375,16 +375,17 @@
 software
+%0D
 %0A * dist
@@ -445,16 +445,17 @@
 %22 BASIS,
+%0D
 %0A * WITH
@@ -522,16 +522,17 @@
 implied.
+%0D
 %0A * See 
@@ -594,16 +594,17 @@
 ions and
+%0D
 %0A * limi
@@ -633,15 +633,18 @@
 nse.
+%0D
 %0A *
+%0D
 %0A */
+%0D
 %0Apac
@@ -669,17 +669,19 @@
 igarcia;
-%0A
+%0D%0A%0D
 %0Aimport 
@@ -720,16 +720,17 @@
 d.given;
+%0D
 %0Aimport 
@@ -766,17 +766,59 @@
 equalTo;
-%0A
+%0D%0A%0D%0Aimport org.junit.jupiter.api.Disabled;%0D
 %0Aimport 
@@ -844,17 +844,19 @@
 pi.Test;
-%0A
+%0D%0A%0D
 %0Apublic 
@@ -885,17 +885,107 @@
 esTest %7B
-%0A
+%0D%0A%0D%0A    @Disabled(%22http://echo.jsontest.com/ is over its serving quota from time to time%22)%0D
 %0A    @Te
@@ -978,32 +978,33 @@
 ime%22)%0D%0A    @Test
+%0D
 %0A    void testEc
@@ -1008,32 +1008,33 @@
 tEchoService() %7B
+%0D
 %0A        String 
@@ -1045,16 +1045,17 @@
 = %22foo%22;
+%0D
 %0A       
@@ -1076,16 +1076,17 @@
 = %22bar%22;
+%0D
 %0A       
@@ -1153,16 +1153,17 @@
 + value)
+%0D
 %0A       
@@ -1234,23 +1234,26 @@
 value));
+%0D
 %0A    %7D
-%0A
+%0D%0A%0D
 %0A    @Te
@@ -1254,16 +1254,17 @@
    @Test
+%0D
 %0A    voi
@@ -1287,16 +1287,17 @@
 vice() %7B
+%0D
 %0A       
@@ -1311,16 +1311,17 @@
 ).when()
+%0D
 %0A       
@@ -1388,16 +1388,17 @@
 ode/ES%22)
+%0D
 %0A       
@@ -1442,16 +1442,17 @@
 ode(200)
+%0D
 %0A       
@@ -1516,14 +1516,18 @@
 %22));
+%0D
 %0A    %7D
-%0A
+%0D%0A%0D
 %0A%7D
+%0D
 %0A

Disable echo service (echo.jsontest.com) test due to flakiness