File tree Expand file tree Collapse file tree 2 files changed +17
-14
lines changed
main/java/de/rieckpil/blog/pit
test/java/de/rieckpil/blog/pit Expand file tree Collapse file tree 2 files changed +17
-14
lines changed Original file line number Diff line number Diff line change @@ -8,13 +8,13 @@ public class FraudDetector {
8
8
Set .of ("WONDERLAND" , "MARS" , "URANUS" );
9
9
10
10
public boolean isFraudulentTransaction (double amount , String country ) {
11
- // Any transaction above 10k is flagged
12
- if (amount > 10_000 ) {
11
+ // Transactions from high-risk countries are flagged
12
+ if (HIGH_RISK_COUNTRIES . contains ( country ) ) {
13
13
return true ;
14
14
}
15
15
16
- // Transactions from high-risk countries are flagged
17
- if (HIGH_RISK_COUNTRIES . contains ( country ) ) {
16
+ // Any transaction above 10k is flagged
17
+ if (amount > 10_000 ) {
18
18
return true ;
19
19
}
20
20
Original file line number Diff line number Diff line change 13
13
class FraudDetectorTest {
14
14
15
15
@ Test
16
- void testHighAmountTransaction () {
16
+ void highAmountTransactionShouldBeFraudulent () {
17
17
FraudDetector detector = new FraudDetector ();
18
-
19
18
assertTrue (detector .isFraudulentTransaction (15_000 , "USA" ));
20
19
}
21
20
22
21
@ Test
23
- void testHighRiskCountryTransaction () {
22
+ void highRiskCountryTransactionShouldBeFraudulent () {
24
23
FraudDetector detector = new FraudDetector ();
25
-
26
24
assertTrue (detector .isFraudulentTransaction (500 , "MARS" ));
27
25
}
28
26
29
- @ Test
30
- void testSafeTransaction () {
31
- FraudDetector cut = new FraudDetector ();
32
-
33
- assertFalse (cut .isFraudulentTransaction (200 , "USA" ));
34
- }
27
+ // @Test
28
+ // void lowAmountTransactionShouldNotBeFraudulent() {
29
+ // FraudDetector detector = new FraudDetector();
30
+ // assertFalse(detector.isFraudulentTransaction(1_000, "USA"));
31
+ // }
32
+ //
33
+ // @Test
34
+ // void thresholdAmountTransactionShouldNotBeFraudulent() {
35
+ // FraudDetector detector = new FraudDetector();
36
+ // assertFalse(detector.isFraudulentTransaction(10_000, "GER"));
37
+ // }
35
38
}
You can’t perform that action at this time.
0 commit comments