-
Notifications
You must be signed in to change notification settings - Fork 0
/
assignment_02_test.java
62 lines (55 loc) · 2.22 KB
/
assignment_02_test.java
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
51
52
53
54
55
56
57
58
59
60
61
62
//Noah Hansen, Jack Schierling, Andriy Zazsypkin
//SWE332 Assignment 2 - test file
import org.junit.*;
import static org.junit.Assert.*;
public class assignment_02_test {
public static void main(String args[]){
org.junit.runner.JUnitCore.main("assignment_02_test");
}
//------------------------------------------------------------
//happyPathTest()
//tests to make sure that the "months" method inside of
//assignment_02 is a happy path
//------------------------------------------------------------
@Test
public void happyPathTest() {
int months = assignment_02.months(100000, 0.08, 1000);
assertEquals("Happy path fails", months, 166);
}
//------------------------------------------------------------
//IAENegativePrincipal
//Tests to make sure that a negative principal parameter would
//throw an IAE
//------------------------------------------------------------
@Test(expected = IllegalArgumentException.class)
public void IAENegativePrincipal() {
assignment_02.months(-100000, 0.08, 1000);
}
//------------------------------------------------------------
//IAENegativeRate()
//Tests to make sure that a negative rate parameter would
//throw an IAE
//------------------------------------------------------------
@Test(expected = IllegalArgumentException.class)
public void IAENegativeRate() {
assignment_02.months(100000, -0.08, 1000);
}
//------------------------------------------------------------
//IAENegativeRate()
//Tests to make sure that a negative payment parameter would
//throw an IAE
//------------------------------------------------------------
@Test(expected = IllegalArgumentException.class)
public void IAENegativePayment() {
assignment_02.months(100000, 0.08, -1000);
}
//------------------------------------------------------------
//IAEPaymentTooSmall()
//Tests to make sure that a payment parameter that is too
//small would throw an IAE
//------------------------------------------------------------
@Test(expected = IllegalArgumentException.class)
public void IAEPaymentTooSmall() {
assignment_02.months(100000, 0.08, 100);
}
}