-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathUtilitiesTest.java
More file actions
50 lines (46 loc) · 1.66 KB
/
UtilitiesTest.java
File metadata and controls
50 lines (46 loc) · 1.66 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/* UtilitiesTest.java */
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
/**
* Tests for the Utilities class.
*
* <h2>Reflection:</h2>
* Personal learning and insights gained as
* a result of reflecting back on this assignment.
* @author Your Name Here
*
* @author Copyright © 2024 Dr. Jody Paul (GPLv3)
* @version 1.1.2
*/
public class UtilitiesTest {
/** No-parameter constructor for test class UtilitiesTest. */
public UtilitiesTest() {
}
/** Set up the test fixture before every test case method is invoked. */
@BeforeEach
public void setUp() {
}
/** Tear down the test fixture after every test case method exits. */
@AfterEach
public void tearDown() {
}
/** Test numberOfConnections with single-digit positive values. */
@Test
public void numberOfConnectionsTestSmallValidParams() {
assertEquals(0, Utilities.numberOfConnections(0));
assertEquals(0, Utilities.numberOfConnections(1));
assertEquals(1, Utilities.numberOfConnections(2));
assertEquals(3, Utilities.numberOfConnections(3));
assertEquals(6, Utilities.numberOfConnections(4));
assertEquals(10, Utilities.numberOfConnections(5));
}
/** Test numberOfConnections with a range of positive values. */
@Test
public void numberOfConnectionsTestLargerValidParams() {
assertEquals(4950L, Utilities.numberOfConnections(100));
assertEquals(499500L, Utilities.numberOfConnections(1000));
assertEquals(49995000L, Utilities.numberOfConnections(10000));
}
}