Search in sources :

Example 1 with MockConnection

use of com.microsoft.graph.http.MockConnection in project msgraph-sdk-java by microsoftgraph.

the class DefaultSeralizerTests method testResponseHeaders.

@Test
public void testResponseHeaders() throws Exception {
    MockConnection connection = new MockConnection(null);
    final DefaultSerializer serializer = new DefaultSerializer(new DefaultLogger());
    User user = serializer.deserializeObject("{\"id\":\"1\"}", User.class, connection.getResponseHeaders());
    JsonElement responseHeaders = user.additionalDataManager().get("graphResponseHeaders");
    assertNotNull(responseHeaders);
    JsonElement responseHeader = responseHeaders.getAsJsonObject().get("header1");
    assertNotNull(responseHeader);
    assertEquals("value1", responseHeader.getAsJsonArray().get(0).getAsString());
}
Also used : User(com.microsoft.graph.models.extensions.User) JsonElement(com.google.gson.JsonElement) MockConnection(com.microsoft.graph.http.MockConnection) DefaultLogger(com.microsoft.graph.logger.DefaultLogger) Test(org.junit.Test)

Aggregations

JsonElement (com.google.gson.JsonElement)1 MockConnection (com.microsoft.graph.http.MockConnection)1 DefaultLogger (com.microsoft.graph.logger.DefaultLogger)1 User (com.microsoft.graph.models.extensions.User)1 Test (org.junit.Test)1