|
19 | 19 | import java.util.List; |
20 | 20 | import java.util.regex.Pattern; |
21 | 21 |
|
22 | | -import static utils.arrays.ArrayUtilities.isLastMemberOf; |
| 22 | +import static utils.arrays.ArrayUtilities.*; |
23 | 23 | import static utils.email.EmailUtilities.Inbox.EmailField.CONTENT; |
24 | 24 | import static utils.email.EmailUtilities.Inbox.EmailField.SUBJECT; |
25 | 25 | import static utils.MappingUtilities.Json.*; |
@@ -241,12 +241,39 @@ public void setFieldTest() { |
241 | 241 | expectedFieldValue, |
242 | 242 | pet.getName() |
243 | 243 | ); |
244 | | - printer.success("The setFieldTest() test passed!"); |
| 244 | + printer.success("The setFieldTest() test pass!"); |
245 | 245 | } |
246 | 246 |
|
247 | 247 | @Test |
248 | 248 | public void lastItemOfTest() { |
249 | 249 | List<Integer> integers = List.of(1, 2, 3, 4, 5); |
250 | 250 | Assert.assertTrue("Integer was not the last member!", isLastMemberOf(integers, 5)); |
| 251 | + printer.success("The lastItemOfTest() test pass!"); |
| 252 | + } |
| 253 | + |
| 254 | + @Test |
| 255 | + public void partitionTest() { |
| 256 | + List<Integer> integers = List.of(1, 2, 3, 4, 5); |
| 257 | + List<List<Integer>> partitionLists = List.of( |
| 258 | + List.of(1,2), |
| 259 | + List.of(3,4), |
| 260 | + List.of(5) |
| 261 | + ); |
| 262 | + for (int i = 0; i < getPartitionCount(integers.size(), 2); i++) { |
| 263 | + List<Integer> partition = getListPartition(integers, 2, i); |
| 264 | + Assert.assertEquals(partition, partitionLists.get(i)); |
| 265 | + } |
| 266 | + printer.success("The partitionTest() test pass!"); |
| 267 | + } |
| 268 | + |
| 269 | + @Test |
| 270 | + public void partitionCountTest() { |
| 271 | + List<Integer> integers = List.of(1, 2, 3, 4, 5); |
| 272 | + Assert.assertEquals( |
| 273 | + "The getPartitionCount() method returns an incorrect value!", |
| 274 | + 3, |
| 275 | + getPartitionCount(integers.size(), 2) |
| 276 | + ); |
| 277 | + printer.success("The partitionCountTest() test pass!"); |
251 | 278 | } |
252 | 279 | } |
0 commit comments