-
Notifications
You must be signed in to change notification settings - Fork 4
/
LearnComparatorsTest.java
71 lines (63 loc) · 1.74 KB
/
LearnComparatorsTest.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
63
64
65
66
67
68
69
import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
/**
* The test class LearnArrayListWithIteratorsTest.
*
* @author (your name)
* @version (a version number or a date)
*/
public class LearnComparatorsTest
{
/**
* Default constructor for test class LearnArrayListWithIteratorsTest
*/
public LearnComparatorsTest()
{
}
/**
* Sets up the test fixture.
*
* Called before every test case method.
*/
@Before
public void setUp()
{
}
/**
* Tears down the test fixture.
*
* Called after every test case method.
*/
@After
public void tearDown()
{
}
@Test
public void testAddAccounts()
{
BankAccounts bankAccounts = new BankAccounts();
bankAccounts.addAccounts();
assertEquals(928.72, bankAccounts.accountList.get(4).getBalance(), 0.1);
assertEquals("Bellatrix", bankAccounts.accountList.get(4).getName());
}
@Test
public void testSortByName()
{
BankAccounts bankAccounts = new BankAccounts();
bankAccounts.addAccounts();
bankAccounts.sortAccountsByName();
assertEquals("Albus", bankAccounts.accountList.get(0).getName());
assertEquals("Sirius", bankAccounts.accountList.get(bankAccounts.accountList.size()-1).getName());
}
@Test
public void testSortByBalance()
{
BankAccounts bankAccounts = new BankAccounts();
bankAccounts.addAccounts();
bankAccounts.sortAccountsByBalance();
assertEquals(10.13, bankAccounts.accountList.get(0).getBalance(), 0.1);
assertEquals(1716.13, bankAccounts.accountList.get(bankAccounts.accountList.size()-1).getBalance(), 0.1);
}
}