package edu.harvard.iq.dataverse.api;

import static com.jayway.restassured.RestAssured.given;
import com.jayway.restassured.response.Response;
import edu.harvard.iq.dataverse.settings.SettingsServiceBean;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.equalTo;

public class InfoIT {

    @Test
    public void testGetDatasetPublishPopupCustomText() {

        given().urlEncodingEnabled(false)
                .body("Hello world!")
                .put("/api/admin/settings/"
                        + SettingsServiceBean.Key.DatasetPublishPopupCustomText);

        Response response = given().urlEncodingEnabled(false)
                .get("/api/info/settings/" + SettingsServiceBean.Key.DatasetPublishPopupCustomText);
        response.prettyPrint();
        response.then().assertThat().statusCode(200)
                .body("data.message", equalTo("Hello world!"));

        given().urlEncodingEnabled(false)
                .delete("/api/admin/settings/"
                        + SettingsServiceBean.Key.DatasetPublishPopupCustomText);

        response = given().urlEncodingEnabled(false)
                .get("/api/info/settings/" + SettingsServiceBean.Key.DatasetPublishPopupCustomText);
        response.prettyPrint();
        response.then().assertThat().statusCode(404)
                .body("message", equalTo("Setting "
                        + SettingsServiceBean.Key.DatasetPublishPopupCustomText
                        + " not found"));
    }
}

@@ -270,16 +270,70 @@
 equalTo;
+%0Aimport static org.hamcrest.CoreMatchers.notNullValue;
 %0A%0Apublic
@@ -1528,10 +1528,603 @@
 ;%0A    %7D%0A
+%0A    @Test%0A    public void testGetVersion() %7B%0A        Response response = given().urlEncodingEnabled(false)%0A                .get(%22/api/info/version%22);%0A        response.prettyPrint();%0A        response.then().assertThat().statusCode(200)%0A                .body(%22data.version%22, notNullValue());%0A    %7D%0A%0A    @Test%0A    public void testGetServer() %7B%0A        Response response = given().urlEncodingEnabled(false)%0A                .get(%22/api/info/server%22);%0A        response.prettyPrint();%0A        response.then().assertThat().statusCode(200)%0A                .body(%22data.message%22, notNullValue());%0A    %7D%0A%0A
 %7D%0A

add REST Assured tests for "version" and "server" #3426