Search in sources :

Example 6 with ResponseCode

use of com.spectralogic.ds3autogen.go.models.response.ResponseCode in project ds3_autogen by SpectraLogic.

the class BaseResponseGenerator_Test method toStringPayloadResponseCode.

@Test
public void toStringPayloadResponseCode() {
    final String expect = "content, err := getResponseBodyAsString(webResponse)\n" + "        if err != nil {\n" + "            return nil, err\n" + "        }\n" + "        return &ResponseName{Content: content}, nil";
    final ResponseCode result = generator.toStringPayloadResponseCode(200, "ResponseName");
    assertThat(result.getCode(), is(200));
    assertThat(result.getParseResponse(), is(expect));
}
Also used : ResponseCode(com.spectralogic.ds3autogen.go.models.response.ResponseCode) Ds3ResponseCode(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode) Test(org.junit.Test)

Example 7 with ResponseCode

use of com.spectralogic.ds3autogen.go.models.response.ResponseCode in project ds3_autogen by SpectraLogic.

the class BaseResponseGenerator_Test method toResponseCode_NullPayload_Test.

@Test
public void toResponseCode_NullPayload_Test() {
    final String expectedGoCode = "return &ResponseName{}, nil";
    final Ds3ResponseCode responseCode = new Ds3ResponseCode(200, ImmutableList.of(new Ds3ResponseType("null", "")));
    final ResponseCode result = generator.toResponseCode(responseCode, "ResponseName");
    assertThat(result.getCode(), is(200));
    assertThat(result.getParseResponse(), is(expectedGoCode));
}
Also used : Ds3ResponseCode(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode) ResponseCode(com.spectralogic.ds3autogen.go.models.response.ResponseCode) Ds3ResponseCode(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode) Ds3ResponseType(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseType) Test(org.junit.Test)

Example 8 with ResponseCode

use of com.spectralogic.ds3autogen.go.models.response.ResponseCode in project ds3_autogen by SpectraLogic.

the class GetObjectResponseGenerator_Test method toResponseCode_206_Test.

@Test
public void toResponseCode_206_Test() {
    final ResponseCode expected = new ResponseCode(206, "return &GetObjectResponse{}, nil");
    final Ds3ResponseCode code = new Ds3ResponseCode(206, ImmutableList.of(new Ds3ResponseType("null", null)));
    final ResponseCode result = generator.toResponseCode(code, "GetObjectResponse");
    assertThat(result, is(expected));
}
Also used : ResponseCode(com.spectralogic.ds3autogen.go.models.response.ResponseCode) Ds3ResponseCode(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode) Ds3ResponseCode(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode) Ds3ResponseType(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseType) Test(org.junit.Test)

Example 9 with ResponseCode

use of com.spectralogic.ds3autogen.go.models.response.ResponseCode in project ds3_autogen by SpectraLogic.

the class BaseResponseGenerator_Test method toNullPayloadResponseCode_Test.

@Test
public void toNullPayloadResponseCode_Test() {
    final String expectedGoCode = "return &ResponseName{}, nil";
    final ResponseCode result = generator.toNullPayloadResponseCode(200, "ResponseName");
    assertThat(result.getCode(), is(200));
    assertThat(result.getParseResponse(), is(expectedGoCode));
}
Also used : ResponseCode(com.spectralogic.ds3autogen.go.models.response.ResponseCode) Ds3ResponseCode(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode) Test(org.junit.Test)

Aggregations

Ds3ResponseCode (com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode)9 ResponseCode (com.spectralogic.ds3autogen.go.models.response.ResponseCode)9 Test (org.junit.Test)9 Ds3ResponseType (com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseType)6