|
1 | 1 | package com.thealgorithms.others; |
2 | 2 |
|
3 | | -import static org.junit.jupiter.api.Assertions.*; |
| 3 | +import static org.junit.jupiter.api.Assertions.assertEquals; |
| 4 | +import static org.junit.jupiter.api.Assertions.assertNotEquals; |
| 5 | +import static org.junit.jupiter.api.Assertions.assertThrows; |
| 6 | +import static org.junit.jupiter.api.Assertions.assertTrue; |
4 | 7 |
|
5 | | -import java.util.*; |
| 8 | +import java.util.List; |
6 | 9 | import org.junit.jupiter.api.Test; |
7 | 10 |
|
8 | | -public class SkylineProblemTest { |
| 11 | +class SkylineProblemTest { |
9 | 12 |
|
10 | 13 | @Test |
11 | 14 | void testSingleBuildingSkyline() { |
@@ -95,8 +98,18 @@ void testFindSkylineInvalidCases() { |
95 | 98 | @Test |
96 | 99 | void testMergeSkylineNullCases() { |
97 | 100 | SkylineProblem skylineProblem = new SkylineProblem(); |
98 | | - Exception ex1 = assertThrows(NullPointerException.class, () -> skylineProblem.mergeSkyline(null, List.of())); |
99 | | - Exception ex2 = assertThrows(NullPointerException.class, () -> skylineProblem.mergeSkyline(List.of(), null)); |
| 101 | + Exception ex1 = assertThrows(NullPointerException.class, new org.junit.jupiter.api.function.Executable() { |
| 102 | + @Override |
| 103 | + public void execute() { |
| 104 | + skylineProblem.mergeSkyline(null, List.of()); |
| 105 | + } |
| 106 | + }); |
| 107 | + Exception ex2 = assertThrows(NullPointerException.class, new org.junit.jupiter.api.function.Executable() { |
| 108 | + @Override |
| 109 | + public void execute() { |
| 110 | + skylineProblem.mergeSkyline(List.of(), null); |
| 111 | + } |
| 112 | + }); |
100 | 113 | assertTrue(ex1.getMessage().contains("sky1")); |
101 | 114 | assertTrue(ex2.getMessage().contains("sky2")); |
102 | 115 | } |
|
0 commit comments