Skip to content

Commit

Permalink
add PIT
Browse files Browse the repository at this point in the history
  • Loading branch information
rieckpil committed Feb 14, 2025
1 parent 6aa3f47 commit fe0ae58
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ public class FraudDetector {
Set.of("WONDERLAND", "MARS", "URANUS");

public boolean isFraudulentTransaction(double amount, String country) {
// Any transaction above 10k is flagged
if (amount > 10_000) {
// Transactions from high-risk countries are flagged
if (HIGH_RISK_COUNTRIES.contains(country)) {
return true;
}

// Transactions from high-risk countries are flagged
if (HIGH_RISK_COUNTRIES.contains(country)) {
// Any transaction above 10k is flagged
if (amount > 10_000) {
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,26 @@
class FraudDetectorTest {

@Test
void testHighAmountTransaction() {
void highAmountTransactionShouldBeFraudulent() {
FraudDetector detector = new FraudDetector();

assertTrue(detector.isFraudulentTransaction(15_000, "USA"));
}

@Test
void testHighRiskCountryTransaction() {
void highRiskCountryTransactionShouldBeFraudulent() {
FraudDetector detector = new FraudDetector();

assertTrue(detector.isFraudulentTransaction(500, "MARS"));
}

@Test
void testSafeTransaction() {
FraudDetector cut = new FraudDetector();

assertFalse(cut.isFraudulentTransaction(200, "USA"));
}
// @Test
// void lowAmountTransactionShouldNotBeFraudulent() {
// FraudDetector detector = new FraudDetector();
// assertFalse(detector.isFraudulentTransaction(1_000, "USA"));
// }
//
// @Test
// void thresholdAmountTransactionShouldNotBeFraudulent() {
// FraudDetector detector = new FraudDetector();
// assertFalse(detector.isFraudulentTransaction(10_000, "GER"));
// }
}

0 comments on commit fe0ae58

Please sign in to comment.