Package com.cumulocity.rest.representation

Examples of com.cumulocity.rest.representation.BaseResourceRepresentation


    public void shouldRetrieveResource() throws Exception {
        // Given
        when(webResource.accept(mediaType)).thenReturn(typeBuilder);
        when(typeBuilder.get(ClientResponse.class)).thenReturn(response);

        BaseResourceRepresentation representation = new BaseResourceRepresentation();
        when(parser.parse(response, 200, BaseResourceRepresentation.class)).thenReturn(representation);

        // When
        BaseResourceRepresentation result = restConnector.get(PATH, mediaType,
                BaseResourceRepresentation.class);

        // Then
        assertThat(result, sameInstance(representation));
    }
View Full Code Here


    }

    @Test
    public void shouldPostBaseRepresentation() throws Exception {
        // Given
        BaseResourceRepresentation representation = new BaseResourceRepresentation();
        returnResponseWhenPosting(representation);
        BaseResourceRepresentation outputRepresentation = new BaseResourceRepresentation();
        when(parser.parse(response, 201, BaseResourceRepresentation.class)).thenReturn(outputRepresentation);

        // When
        BaseResourceRepresentation result = restConnector.post(PATH, mediaType, representation);

        // Then
        assertThat(result, sameInstance(outputRepresentation));
    }
View Full Code Here

    }

    @Test
    public void shouldPutBaseRepresentation() throws Exception {
        // Given
        BaseResourceRepresentation representation = new BaseResourceRepresentation();
        BaseResourceRepresentation outputRepresentation = new BaseResourceRepresentation();
        returnResponseWhenPut(representation);
        when(parser.parse(response, 200, BaseResourceRepresentation.class)).thenReturn(outputRepresentation);

        // When
        BaseResourceRepresentation result = restConnector.put(PATH, mediaType, representation);

        // Then
        assertThat(result, sameInstance(outputRepresentation));
    }
View Full Code Here

    @Test
    public void shouldParse() throws Exception {
        // Given
        when(response.getStatus()).thenReturn(EXPECTED_STATUS);
        BaseResourceRepresentation representation = new BaseResourceRepresentation();
        when(response.getEntity(BaseResourceRepresentation.class)).thenReturn(representation);

        // When
        BaseResourceRepresentation result = parser.parse(response, EXPECTED_STATUS,
                BaseResourceRepresentation.class);

        // Then
        assertThat(result, sameInstance(representation));
    }
View Full Code Here

TOP

Related Classes of com.cumulocity.rest.representation.BaseResourceRepresentation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.