|
1 | 1 | package com.microsoft.graph.content; |
2 | 2 |
|
3 | | -import static org.junit.Assert.assertFalse; |
4 | | -import static org.junit.Assert.assertNotNull; |
5 | | -import static org.junit.Assert.assertThrows; |
6 | | -import static org.junit.Assert.assertTrue; |
| 3 | +import static org.junit.jupiter.api.Assertions.assertFalse; |
| 4 | +import static org.junit.jupiter.api.Assertions.assertNotNull; |
| 5 | +import static org.junit.jupiter.api.Assertions.assertThrows; |
| 6 | +import static org.junit.jupiter.api.Assertions.assertTrue; |
7 | 7 | import static org.mockito.ArgumentMatchers.any; |
8 | 8 | import static org.mockito.Mockito.mock; |
9 | 9 | import static org.mockito.Mockito.when; |
|
19 | 19 | import com.microsoft.graph.logger.ILogger; |
20 | 20 | import com.microsoft.graph.serializer.DefaultSerializer; |
21 | 21 |
|
22 | | -import org.junit.Test; |
| 22 | +import org.junit.jupiter.api.Test; |
23 | 23 | import org.mockito.invocation.InvocationOnMock; |
24 | 24 | import org.mockito.stubbing.Answer; |
25 | 25 |
|
@@ -110,35 +110,34 @@ public String answer(InvocationOnMock invocation) throws Throwable { |
110 | 110 | } |
111 | 111 | }); |
112 | 112 |
|
113 | | - assertThrows("the number of steps cannot exceed 20", IllegalArgumentException.class, () -> { |
| 113 | + assertThrows(IllegalArgumentException.class, () -> { |
114 | 114 | new MSBatchRequestContent(mock(ILogger.class), null, null, null, null, null, null, null, null, null, null, null, null, null, |
115 | 115 | null, null, null, null, null, null, null, null, null); |
116 | | - }); |
117 | | - assertThrows("the logger cannot be null", NullPointerException.class, () -> { |
| 116 | + }, "the number of steps cannot exceed 20"); |
| 117 | + assertThrows(NullPointerException.class, () -> { |
118 | 118 | new MSBatchRequestContent((ILogger) null, (MSBatchRequestStep)null); |
119 | | - }); |
| 119 | + }, "the logger cannot be null"); |
120 | 120 |
|
121 | 121 | new MSBatchRequestContent(mockStep, null); // addind a null step doesn't throw |
122 | | - assertThrows("should throw argument exception", NullPointerException.class, () -> { |
| 122 | + assertThrows(NullPointerException.class, () -> { |
123 | 123 | new MSBatchRequestContent().addBatchRequestStep(null); |
124 | | - }); |
125 | | - assertThrows("should throw argument exception", NullPointerException.class, () -> { |
| 124 | + }, "should throw argument exception"); |
| 125 | + assertThrows(NullPointerException.class, () -> { |
126 | 126 | new MSBatchRequestContent().addBatchRequestStep((Request) null); |
127 | | - }); |
| 127 | + }, "should throw argument exception"); |
128 | 128 |
|
129 | | - assertThrows("the number of steps cannot exceed 20", IllegalArgumentException.class, () -> { |
| 129 | + assertThrows(IllegalArgumentException.class, () -> { |
130 | 130 | final MSBatchRequestContent batchContent = new MSBatchRequestContent(); |
131 | 131 | for (int i = 0; i < MSBatchRequestContent.MAX_NUMBER_OF_REQUESTS; i++) { |
132 | 132 | assertNotNull(batchContent.addBatchRequestStep(mock(Request.class))); |
133 | 133 | } |
134 | 134 | batchContent.addBatchRequestStep(mock(Request.class)); |
135 | | - }); |
| 135 | + }, "the number of steps cannot exceed 20"); |
136 | 136 | { |
137 | 137 | final MSBatchRequestContent batchContent = new MSBatchRequestContent(); |
138 | 138 | reservedIds.clear(); |
139 | 139 | for (int i = 0; i < MSBatchRequestContent.MAX_NUMBER_OF_REQUESTS; i++) { |
140 | | - assertTrue("item number " + i + " should be added successfully", |
141 | | - batchContent.addBatchRequestStep(mockStep)); |
| 140 | + assertTrue(batchContent.addBatchRequestStep(mockStep), "item number " + i + " should be added successfully"); |
142 | 141 | } |
143 | 142 | assertFalse(batchContent.addBatchRequestStep(mockStep)); |
144 | 143 | } |
|
0 commit comments