-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSolarPanelTest.java
More file actions
39 lines (33 loc) · 1.35 KB
/
SolarPanelTest.java
File metadata and controls
39 lines (33 loc) · 1.35 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
/*
Brent Thompson
Software Development 1 COP 3024C
Professor Ashley Evans
October 20th, 2024
Module 8 | DMS Project Phase 2: Software Testing
This SolarPanelTest Class is used to test the functionality of the Solar Panel class
*/
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class SolarPanelTest {
SolarPanel newPanel;
@org.junit.jupiter.api.BeforeEach
void setUp() {
// New solar panel object used for testing
newPanel = new SolarPanel("Test101", "F443ss2","Solar", 8.1F, 6, 10);
}
@org.junit.jupiter.api.Test
@org.junit.jupiter.api.DisplayName("Calculate Number of Cells Test")
void calculateNumberCellsTest() {
// Using our own test data, calculate the number of cells
int NumberCells = newPanel.getNumberCellsX() * newPanel.getNumberCellsY();
assertEquals(60, NumberCells, "Error. Number of Cells is incorrect");
}
@org.junit.jupiter.api.Test
@org.junit.jupiter.api.DisplayName("Calculate Power per Cell Test")
void calculatePowerPerCellTest() {
// Calculate the power for each cell
int NumberCells = newPanel.getNumberCellsX() * newPanel.getNumberCellsY();
assertEquals(0.135F, 8.1F/NumberCells, "Error. Power per Cell is incorrect");
}
}