87 lines
3.4 KiB
Java
87 lines
3.4 KiB
Java
import org.junit.*;
|
|
import java.util.ArrayList;
|
|
import static org.junit.Assert.*;
|
|
/****************************************************
|
|
* MyCarTestPhase1 - to test the class Car Phase1
|
|
*
|
|
* @author Resendiz
|
|
* @version February 2021
|
|
****************************************************/
|
|
public class MyPreApprovedListTest {
|
|
|
|
/******************************************************
|
|
* Test default constructor - no input parameters
|
|
*****************************************************/
|
|
@Test
|
|
public void testConstructor() {
|
|
/* Credit Union */
|
|
CreditUnion cu = new CreditUnion();
|
|
assertEquals("ArrayList should contain no records at this time",
|
|
0, cu.getPreApprovedList().size());
|
|
}
|
|
|
|
/******************************************************
|
|
* Test Pre-Approved List with Zero Credit Scores above or equal at 700
|
|
*****************************************************/
|
|
@Test
|
|
public void testNoGoodCreditScores() {
|
|
/* Credit Union */
|
|
CreditUnion cu = new CreditUnion();
|
|
|
|
cu.addHomeBuyer(new HomeBuyer("first","last",600));
|
|
cu.addHomeBuyer(new HomeBuyer("first","last",650));
|
|
cu.addHomeBuyer(new HomeBuyer("first","last",500));
|
|
cu.addHomeBuyer(new HomeBuyer("first","last",599));
|
|
cu.addHomeBuyer(new HomeBuyer("first","last",699));
|
|
|
|
ArrayList<HomeBuyer> preApprovedList = cu.getPreApprovedList();
|
|
|
|
assertEquals("preApprovedList.size() should have returned 0 buyers " +
|
|
"on the pre-approved list but incorrectly returned " + preApprovedList.size(),
|
|
0, preApprovedList.size());
|
|
}
|
|
|
|
/******************************************************
|
|
* Test Pre-Approved List with One Credit Score above or equal at 700
|
|
*****************************************************/
|
|
@Test
|
|
public void testOneGoodCreditScores() {
|
|
/* Credit Union */
|
|
CreditUnion cu = new CreditUnion();
|
|
|
|
cu.addHomeBuyer(new HomeBuyer("first","last",600));
|
|
cu.addHomeBuyer(new HomeBuyer("first","last",650));
|
|
cu.addHomeBuyer(new HomeBuyer("first","last",800));
|
|
cu.addHomeBuyer(new HomeBuyer("first","last",599));
|
|
cu.addHomeBuyer(new HomeBuyer("first","last",699));
|
|
|
|
ArrayList<HomeBuyer> preApprovedList = cu.getPreApprovedList();
|
|
|
|
assertEquals("preApprovedList.size() should have returned 1 buyer " +
|
|
"on the pre-approved list but incorrectly returned " + preApprovedList.size(),
|
|
1, preApprovedList.size());
|
|
}
|
|
|
|
/******************************************************
|
|
* Test Pre-Approved List with Two Credit Score above or equal at 700
|
|
*****************************************************/
|
|
@Test
|
|
public void testTwoGoodCreditScores() {
|
|
/* Credit Union */
|
|
CreditUnion cu = new CreditUnion();
|
|
|
|
cu.addHomeBuyer(new HomeBuyer("first","last",700));
|
|
cu.addHomeBuyer(new HomeBuyer("first","last",650));
|
|
cu.addHomeBuyer(new HomeBuyer("first","last",800));
|
|
cu.addHomeBuyer(new HomeBuyer("first","last",599));
|
|
cu.addHomeBuyer(new HomeBuyer("first","last",699));
|
|
|
|
ArrayList<HomeBuyer> preApprovedList = cu.getPreApprovedList();
|
|
|
|
assertEquals("preApprovedList.size() should have returned 2 buyers " +
|
|
"on the pre-approved list but incorrectly returned " + preApprovedList.size(),
|
|
2, preApprovedList.size());
|
|
}
|
|
|
|
|
|
} |