Skip to content

Commit 345a6a6

Browse files
Minor instance access changes for TDD test
1 parent 13bf5a4 commit 345a6a6

File tree

4 files changed

+8
-24
lines changed

4 files changed

+8
-24
lines changed

src/main/java/com/diffblue/corebanking/account/Account.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,6 @@ public String toString() {
187187
return output;
188188
}
189189

190-
public void foo() {}
191-
192190
/** AccountState. */
193191
public enum AccountState {
194192
OPEN,
@@ -209,7 +207,7 @@ private AccountStatement() {
209207
*
210208
* @return The transactions list.
211209
*/
212-
private List<Transaction> getTransactions() {
210+
public List<Transaction> getTransactions() {
213211
return transactions;
214212
}
215213

@@ -239,5 +237,6 @@ public String toString() {
239237

240238
return output;
241239
}
240+
242241
}
243242
}

src/main/java/com/diffblue/corebanking/compliance/CheckCompliance.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
public class CheckCompliance {
1010

11-
private static final List<ComplianceRule> COMPLIANCE_RULES = new ArrayList<ComplianceRule>();
11+
public static final List<ComplianceRule> COMPLIANCE_RULES = new ArrayList<ComplianceRule>();
1212

1313
static {
1414
COMPLIANCE_RULES.add(new ComplianceRuleBalanceAboveOrEqualToZero());

src/main/java/com/diffblue/corebanking/compliance/rules/ComplianceRule.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,13 @@ public abstract class ComplianceRule {
88

99
protected final List<Account> currentFailedAccounts = new ArrayList<Account>();
1010
protected final List<Account> currentPassedAccounts = new ArrayList<Account>();
11-
private final int ruleID;
12-
13-
/**
14-
* Constructor.
15-
*
16-
* @param ruleID The ID of the rule instance.
17-
*/
18-
protected ComplianceRule(int ruleID) {
19-
this.ruleID = ruleID;
20-
}
2111

2212
/**
2313
* Checks if the passed account passes or fails this rule.
2414
*
2515
* @param account The account to verify compliance.
2616
*/
27-
public abstract void ValidateAccountCompliance(Account account);
17+
public abstract boolean ValidateAccountCompliance(Account account);
2818

2919
/** Purges all accounts from the rules. */
3020
public void purgeAccounts() {

src/main/java/com/diffblue/corebanking/compliance/rules/ComplianceRuleBalanceAboveOrEqualToZero.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,12 @@
44

55
public class ComplianceRuleBalanceAboveOrEqualToZero extends ComplianceRule {
66

7-
private static final int RULE_ID = 1;
8-
9-
/** Constructor. */
10-
public ComplianceRuleBalanceAboveOrEqualToZero() {
11-
super(RULE_ID);
12-
}
13-
147
/**
158
* Checks if the passed account passes or fails this rule.
169
*
1710
* @param account The account to verify compliance.
1811
*/
19-
public void ValidateAccountCompliance(Account account) {
12+
public boolean ValidateAccountCompliance(Account account) {
2013

2114
// Make sure the account does not belong to any list.
2215
currentFailedAccounts.remove(account);
@@ -25,8 +18,10 @@ public void ValidateAccountCompliance(Account account) {
2518
// Check if this account passes or fails this rule.
2619
if (account.getCurrentBalance() >= 0) {
2720
currentPassedAccounts.add(account);
28-
} else if (false) {
21+
return true;
22+
} else {
2923
currentFailedAccounts.add(account);
24+
return false;
3025
}
3126
}
3227
}

0 commit comments

Comments
 (0)