Skip to content

Commit b9babb7

Browse files
committed
Fix test checkstyle
1 parent 501bcfb commit b9babb7

File tree

1 file changed

+37
-40
lines changed

1 file changed

+37
-40
lines changed
Lines changed: 37 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,118 +1,115 @@
11
package balancer.logic.command;
22

3-
import balancer.storage.Transaction;
4-
import org.junit.jupiter.api.Test;
3+
import static org.junit.jupiter.api.Assertions.assertEquals;
54

6-
import java.util.ArrayList;
75
import java.util.HashMap;
86
import java.util.List;
97

10-
import static org.junit.jupiter.api.Assertions.*;
8+
import org.junit.jupiter.api.Test;
9+
10+
import balancer.storage.Transaction;
1111

1212
class CalculateCommandTest {
13-
CalculateCommand cc = new CalculateCommand();
13+
private CalculateCommand cc = new CalculateCommand();
1414

1515
@Test
16-
public void one_person_pay_two_persons() {
16+
public void onePersonPayTwoPersons() {
1717
HashMap<String, Transaction> transactions = new HashMap<>();
1818
transactions.put("Alice", new Transaction("Alice", 40));
1919
transactions.put("Bob", new Transaction("Bob", 40));
2020
transactions.put("Charlie", new Transaction("Charlie", 10));
2121
List<Transaction> transactionList = cc.preprocess(transactions);
2222

23-
String expected = "Charlie has to pay Alice $10.00\n" +
24-
"Charlie has to pay Bob $10.00\n" +
25-
"\n" +
26-
"Number of transactions: 2";
23+
String expected = "Charlie has to pay Alice $10.00\n"
24+
+ "Charlie has to pay Bob $10.00\n"
25+
+ "\n"
26+
+ "Number of transactions: 2";
2727
String actual = cc.greedy(transactionList);
2828
assertEquals(expected, actual);
2929
}
3030

3131
@Test
32-
public void one_person_pay_two_persons_2dp() {
32+
public void onePersonPayTwoPersons2dp() {
3333
HashMap<String, Transaction> transactions = new HashMap<>();
3434
transactions.put("Alice", new Transaction("Alice", 40.105));
3535
transactions.put("Bob", new Transaction("Bob", 40.105));
3636
transactions.put("Charlie", new Transaction("Charlie", 10));
3737
List<Transaction> transactionList = cc.preprocess(transactions);
3838

39-
String expected = "Charlie has to pay Alice $10.04\n" +
40-
"Charlie has to pay Bob $10.03\n" +
41-
"\n" +
42-
"Number of transactions: 2";
39+
String expected = "Charlie has to pay Alice $10.04\n"
40+
+ "Charlie has to pay Bob $10.03\n"
41+
+ "\n"
42+
+ "Number of transactions: 2";
4343
String actual = cc.greedy(transactionList);
4444
assertEquals(expected, actual);
4545
}
4646

4747
@Test
48-
public void four_persons_1() {
48+
public void fourPersons1() {
4949
HashMap<String, Transaction> transactions = new HashMap<>();
5050
transactions.put("Alice", new Transaction("Alice", 10));
5151
transactions.put("Bob", new Transaction("Bob", 20));
5252
transactions.put("Charlie", new Transaction("Charlie", 0));
5353
transactions.put("Don", new Transaction("Don", 10));
5454
List<Transaction> transactionList = cc.preprocess(transactions);
5555

56-
String expected = "Charlie has to pay Bob $10.00\n" +
57-
"\n" +
58-
"Number of transactions: 1";
56+
String expected = "Charlie has to pay Bob $10.00\n"
57+
+ "\n"
58+
+ "Number of transactions: 1";
5959
String actual = cc.greedy(transactionList);
6060
assertEquals(expected, actual);
6161
}
6262

6363
@Test
64-
public void four_persons_2() {
64+
public void fourPersons2() {
6565
HashMap<String, Transaction> transactions = new HashMap<>();
6666
transactions.put("Alice", new Transaction("Alice", 40));
6767
transactions.put("Bob", new Transaction("Bob", 40));
6868
transactions.put("Charlie", new Transaction("Charlie", 10));
6969
transactions.put("Don", new Transaction("Don", 10));
7070
List<Transaction> transactionList = cc.preprocess(transactions);
7171

72-
String expected = "Don has to pay Alice $15.00\n" +
73-
"Charlie has to pay Bob $15.00\n" +
74-
"\n" +
75-
"Number of transactions: 2";
72+
String expected = "Don has to pay Alice $15.00\n"
73+
+ "Charlie has to pay Bob $15.00\n"
74+
+ "\n"
75+
+ "Number of transactions: 2";
7676
String actual = cc.greedy(transactionList);
7777
assertEquals(expected, actual);
7878
}
7979

8080
@Test
81-
public void four_persons_with_one_significantly_more() {
81+
public void fourPersonsWithOneSignificantlyMmore() {
8282
HashMap<String, Transaction> transactions = new HashMap<>();
8383
transactions.put("Alice", new Transaction("Alice", 200));
8484
transactions.put("Bob", new Transaction("Bob", 80));
8585
transactions.put("Charlie", new Transaction("Charlie", 50));
8686
transactions.put("Don", new Transaction("Don", 20));
8787
List<Transaction> transactionList = cc.preprocess(transactions);
8888

89-
String expected = "Don has to pay Alice $67.50\n" +
90-
"Charlie has to pay Alice $37.50\n" +
91-
"Bob has to pay Alice $7.50\n" +
92-
"\n" +
93-
"Number of transactions: 3";
89+
String expected = "Don has to pay Alice $67.50\n"
90+
+ "Charlie has to pay Alice $37.50\n"
91+
+ "Bob has to pay Alice $7.50\n"
92+
+ "\n"
93+
+ "Number of transactions: 3";
9494
String actual = cc.greedy(transactionList);
9595
assertEquals(expected, actual);
9696
}
9797

9898
@Test
99-
public void four_persons_with_two_significantly_more() {
99+
public void fourPersonsWithTwoSignificantlyMore() {
100100
HashMap<String, Transaction> transactions = new HashMap<>();
101101
transactions.put("Alice", new Transaction("Alice", 160));
102102
transactions.put("Bob", new Transaction("Bob", 120));
103103
transactions.put("Charlie", new Transaction("Charlie", 50));
104104
transactions.put("Don", new Transaction("Don", 20));
105105
List<Transaction> transactionList = cc.preprocess(transactions);
106106

107-
String expected = "Don has to pay Alice $67.50\n" +
108-
"Charlie has to pay Bob $32.50\n" +
109-
"Charlie has to pay Alice $5.00\n" +
110-
"\n" +
111-
"Number of transactions: 3";
107+
String expected = "Don has to pay Alice $67.50\n"
108+
+ "Charlie has to pay Bob $32.50\n"
109+
+ "Charlie has to pay Alice $5.00\n"
110+
+ "\n"
111+
+ "Number of transactions: 3";
112112
String actual = cc.greedy(transactionList);
113113
assertEquals(expected, actual);
114114
}
115-
116-
117-
118-
}
115+
}

0 commit comments

Comments
 (0)