forked from TheAlgorithms/Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFindMaxTest.java
More file actions
29 lines (22 loc) · 763 Bytes
/
Copy pathFindMaxTest.java
File metadata and controls
29 lines (22 loc) · 763 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package com.thealgorithms.maths;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import org.junit.jupiter.api.Test;
public class FindMaxTest {
@Test
public void testFindMax0() {
assertEquals(10, FindMax.findMax(new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}));
}
@Test
public void testFindMax1() {
assertEquals(7, FindMax.findMax(new int[] {6, 3, 5, 1, 7, 4, 1}));
}
@Test
public void testFindMax2() {
assertEquals(10, FindMax.findMax(new int[] {10, 0}));
}
@Test
public void testFindMaxThrowsExceptionForEmptyInput() {
assertThrows(IllegalArgumentException.class, () -> FindMax.findMax(new int[] {}));
}
}