Skip to content

Commit 97e8397

Browse files
committed
- adds additinoal unit tests cases for body header in batches
1 parent b6b5f8a commit 97e8397

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

‎src/test/java/com/microsoft/graph/content/BatchRequestContentTest.java‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,5 +224,22 @@ public AdditionalDataManager additionalDataManager() {
224224
final BatchRequestStep<?> step = batchRequest.getStepById(stepId);
225225
assertNotNull(step.headers);
226226
assertEquals("application/json", step.headers.get("content-type"));
227+
228+
when(requestStep.getHeaders()).thenReturn(Arrays.asList(new HeaderOption("dummy", "dummy")));
229+
final String stepId2 = batchRequest.addBatchRequestStep(requestStep, HttpMethod.POST, body);
230+
final BatchRequestStep<?> step2 = batchRequest.getStepById(stepId2);
231+
assertNotNull(step2.headers);
232+
assertEquals("application/json", step2.headers.get("content-type"));
233+
234+
final String stepId3 = batchRequest.addBatchRequestStep(requestStep, HttpMethod.POST, Integer.valueOf(10));
235+
final BatchRequestStep<?> step3 = batchRequest.getStepById(stepId3);
236+
assertNotNull(step3.headers);
237+
assertNull(step3.headers.get("content-type"));
238+
239+
when(requestStep.getHeaders()).thenReturn(Arrays.asList(new HeaderOption("Content-type", "application/octect-stream")));
240+
final String stepId4 = batchRequest.addBatchRequestStep(requestStep, HttpMethod.POST, Integer.valueOf(10));
241+
final BatchRequestStep<?> step4 = batchRequest.getStepById(stepId4);
242+
assertNotNull(step4.headers);
243+
assertEquals("application/octect-stream", step4.headers.get("content-type"));
227244
}
228245
}

0 commit comments

Comments
 (0)