Skip to content

Commit bbf4041

Browse files
committed
- adds batch response parsing to unit test
1 parent e172823 commit bbf4041

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/test/java/com/microsoft/graph/functional/BatchTests.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import java.io.IOException;
77

88
import com.microsoft.graph.content.MSBatchRequestContent;
9+
import com.microsoft.graph.content.MSBatchResponseContent;
910
import com.microsoft.graph.http.HttpMethod;
1011
import com.microsoft.graph.httpcore.HttpClients;
1112
import com.microsoft.graph.httpcore.ICoreAuthenticationProvider;
@@ -64,6 +65,12 @@ public void GetsABatchFromRequests() throws IOException{
6465

6566
final OkHttpClient client = HttpClients.createDefault((ICoreAuthenticationProvider)graphServiceClient.getAuthenticationProvider());
6667
final Response batchResponse = client.newCall(batchRequest).execute();
67-
assertEquals(batchResponse.code(), 200);
68+
assertEquals(200, batchResponse.code());
69+
70+
final MSBatchResponseContent responseContent = new MSBatchResponseContent(batchResponse);
71+
72+
assertEquals(400, responseContent.getResponseById(userPostId).code()); //400:we're not providing enough properties for the call to go through
73+
assertEquals(200, responseContent.getResponseById(meGetId).code());
74+
assertEquals(200, responseContent.getResponseById(usersGetId).code());
6875
}
6976
}

0 commit comments

Comments
 (0)