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 {
88 Set .of ("WONDERLAND" , "MARS" , "URANUS" );
99
1010 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 ) ) {
1313 return true ;
1414 }
1515
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 ) {
1818 return true ;
1919 }
2020
Original file line number Diff line number Diff line change 1313class FraudDetectorTest {
1414
1515 @ Test
16- void testHighAmountTransaction () {
16+ void highAmountTransactionShouldBeFraudulent () {
1717 FraudDetector detector = new FraudDetector ();
18-
1918 assertTrue (detector .isFraudulentTransaction (15_000 , "USA" ));
2019 }
2120
2221 @ Test
23- void testHighRiskCountryTransaction () {
22+ void highRiskCountryTransactionShouldBeFraudulent () {
2423 FraudDetector detector = new FraudDetector ();
25-
2624 assertTrue (detector .isFraudulentTransaction (500 , "MARS" ));
2725 }
2826
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+ // }
3538}
You can’t perform that action at this time.
0 commit comments