Search in sources :

Example 21 with Ds3ResponseType

use of com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseType in project ds3_autogen by SpectraLogic.

the class ResponsePayloadUtil_Test method getAllNonErrorResponseCodes_FullList_Test.

@Test
public void getAllNonErrorResponseCodes_FullList_Test() {
    final ImmutableList<Ds3ResponseCode> codes = ImmutableList.of(new Ds3ResponseCode(200, ImmutableList.of(new Ds3ResponseType("com.test.ResponseType", null))), new Ds3ResponseCode(204, ImmutableList.of(new Ds3ResponseType("com.test.ResponseType", null))), new Ds3ResponseCode(400, ImmutableList.of(new Ds3ResponseType("com.test.ResponseType", null))));
    final ImmutableList<Integer> result = getAllNonErrorResponseCodes(codes);
    assertThat(result.size(), is(2));
    assertThat(result, hasItem(200));
    assertThat(result, hasItem(204));
}
Also used : Ds3ResponseCode(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode) Ds3ResponseType(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseType) Test(org.junit.Test)

Example 22 with Ds3ResponseType

use of com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseType in project ds3_autogen by SpectraLogic.

the class ResponsePayloadUtil_Test method getResponsePayload_NoResponsePayload_Test.

@Test
public void getResponsePayload_NoResponsePayload_Test() {
    final ImmutableList<Ds3ResponseCode> codes = ImmutableList.of(new Ds3ResponseCode(204, ImmutableList.of(new Ds3ResponseType("null", null))));
    assertThat(getResponsePayload(codes), is(nullValue()));
}
Also used : Ds3ResponseCode(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode) Ds3ResponseType(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseType) Test(org.junit.Test)

Example 23 with Ds3ResponseType

use of com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseType in project ds3_autogen by SpectraLogic.

the class ResponsePayloadUtil_Test method getResponsePayload_Exception_Test.

@Test(expected = IllegalArgumentException.class)
public void getResponsePayload_Exception_Test() {
    final ImmutableList<Ds3ResponseCode> codes = ImmutableList.of(new Ds3ResponseCode(200, ImmutableList.of(new Ds3ResponseType("ResponseType", null))), new Ds3ResponseCode(204, ImmutableList.of(new Ds3ResponseType("ResponseType2", null))));
    getResponsePayload(codes);
}
Also used : Ds3ResponseCode(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode) Ds3ResponseType(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseType) Test(org.junit.Test)

Example 24 with Ds3ResponseType

use of com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseType in project ds3_autogen by SpectraLogic.

the class BaseResponseParserGenerator_Test method getResponseCode_Test.

@Test
public void getResponseCode_Test() {
    final ImmutableList<Ds3ResponseCode> codes = ImmutableList.of(new Ds3ResponseCode(200, ImmutableList.of(new Ds3ResponseType("com.test.ResponsePayload", null))), new Ds3ResponseCode(400, ImmutableList.of(new Ds3ResponseType("com.test.ErrorPayload", null))));
    final Integer result = getResponseCode(codes);
    assertThat(result, is(200));
}
Also used : Ds3ResponseCode(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode) Ds3ResponseType(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseType) Test(org.junit.Test)

Example 25 with Ds3ResponseType

use of com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseType in project ds3_autogen by SpectraLogic.

the class ResponseAndParserUtil_Test method getResponseModelName_ComponentType_Test.

@Test
public void getResponseModelName_ComponentType_Test() {
    final Ds3ResponseType responseType = new Ds3ResponseType("array", "com.test.ComponentType");
    assertThat(getResponseModelName(responseType), is("List<ComponentType>"));
}
Also used : Ds3ResponseType(com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseType) Test(org.junit.Test)

Aggregations

Ds3ResponseType (com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseType)35 Test (org.junit.Test)31 Ds3ResponseCode (com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode)30 ResponseCode (com.spectralogic.ds3autogen.go.models.response.ResponseCode)6 Arguments (com.spectralogic.ds3autogen.api.models.Arguments)5 ResponseCode (com.spectralogic.ds3autogen.java.models.ResponseCode)2 ImmutableList (com.google.common.collect.ImmutableList)1 Ds3ResponseCodeFixtureTestHelper.createPopulatedErrorResponseCode (com.spectralogic.ds3autogen.java.test.helpers.Ds3ResponseCodeFixtureTestHelper.createPopulatedErrorResponseCode)1 Ds3ResponseCodeFixtureTestHelper.createPopulatedResponseCode (com.spectralogic.ds3autogen.java.test.helpers.Ds3ResponseCodeFixtureTestHelper.createPopulatedResponseCode)1