|
1
|
|
package com.rbctcsworld.ecommerce.payment; |
|
2
|
|
|
|
3
|
|
import com.rbctcsworld.ecommerce.auth.AppUser; |
|
4
|
|
import com.rbctcsworld.ecommerce.auth.UserRepository; |
|
5
|
|
import com.rbctcsworld.ecommerce.common.exception.BusinessRuleException; |
|
6
|
|
import com.rbctcsworld.ecommerce.common.exception.ConflictException; |
|
7
|
|
import com.rbctcsworld.ecommerce.common.exception.NotFoundException; |
|
8
|
|
import com.rbctcsworld.ecommerce.payment.PaymentDtos.AddCardRequest; |
|
9
|
|
import com.rbctcsworld.ecommerce.payment.PaymentDtos.MethodResponse; |
|
10
|
|
import org.springframework.stereotype.Service; |
|
11
|
|
import org.springframework.transaction.annotation.Transactional; |
|
12
|
|
|
|
13
|
|
import java.time.Clock; |
|
14
|
|
import java.time.YearMonth; |
|
15
|
|
import java.util.Comparator; |
|
16
|
|
import java.util.List; |
|
17
|
|
|
|
18
|
|
/** |
|
19
|
|
* The customer's wallet of saved cards. Rules: |
|
20
|
|
* - what is kept: brand, last 4, expiry and the provider's token - never the number or the CVV; |
|
21
|
|
* - at most {@value #MAX} cards (409), the same card twice is refused (409); |
|
22
|
|
* - the first card is the default; makeDefault moves it; deleting the default makes the newest remaining card default; |
|
23
|
|
* - somebody else's card does not exist for you (404); |
|
24
|
|
* - a malformed, Luhn-invalid or expired card is 400 and a card the provider cannot use is 400. |
|
25
|
|
*/ |
|
26
|
|
@Service |
|
27
|
|
@Transactional |
|
28
|
|
public class PaymentMethodService { |
|
29
|
|
|
|
30
|
|
public static final int MAX = 5; |
|
31
|
|
|
|
32
|
|
private final SavedPaymentMethodRepository repo; |
|
33
|
|
private final UserRepository users; |
|
34
|
|
private final PaymentGateway gateway; |
|
35
|
|
private final Clock clock; |
|
36
|
|
|
|
37
|
|
public PaymentMethodService(SavedPaymentMethodRepository repo, UserRepository users, PaymentGateway gateway, Clock clock) { |
|
38
|
|
this.repo = repo; |
|
39
|
|
this.users = users; |
|
40
|
|
this.gateway = gateway; |
|
41
|
|
this.clock = clock; |
|
42
|
|
} |
|
43
|
|
|
|
44
|
|
@Transactional(readOnly = true) |
|
45
|
|
public List<MethodResponse> list(String email) { |
|
46
|
|
YearMonth now = YearMonth.now(clock); |
|
47
|
2
1. lambda$list$0 : replaced return value with null for com/rbctcsworld/ecommerce/payment/PaymentMethodService::lambda$list$0 → KILLED
2. list : replaced return value with Collections.emptyList for com/rbctcsworld/ecommerce/payment/PaymentMethodService::list → KILLED
|
return mine(user(email).getId()).stream().map(m -> MethodResponse.from(m, now)).toList(); |
|
48
|
|
} |
|
49
|
|
|
|
50
|
|
public MethodResponse add(String email, AddCardRequest r) { |
|
51
|
|
Long userId = user(email).getId(); |
|
52
|
1
1. add : replaced return value with null for com/rbctcsworld/ecommerce/payment/PaymentMethodService::add → KILLED
|
return MethodResponse.from(save(userId, r.cardNumber(), r.expiryMonth(), r.expiryYear(), r.makeDefault()), YearMonth.now(clock)); |
|
53
|
|
} |
|
54
|
|
|
|
55
|
|
/** "Save this card" after a payment went through: never fails the payment, a full wallet or a twin is simply skipped. */ |
|
56
|
|
public void saveAfterPayment(String email, String cardNumber, int month, int year) { |
|
57
|
|
try { |
|
58
|
|
save(user(email).getId(), cardNumber, month, year, false); |
|
59
|
|
} catch (ConflictException | BusinessRuleException ignored) { |
|
60
|
|
// wallet full, card already saved, or not storable at the provider: the payment itself succeeded |
|
61
|
|
} |
|
62
|
|
} |
|
63
|
|
|
|
64
|
|
private SavedPaymentMethod save(Long userId, String rawNumber, int month, int year, boolean makeDefault) { |
|
65
|
|
String number = rawNumber.replace(" ", ""); |
|
66
|
5
1. save : changed conditional boundary → SURVIVED
2. save : changed conditional boundary → SURVIVED
3. save : removed conditional - replaced equality check with false → KILLED
4. save : removed conditional - replaced comparison check with false → KILLED
5. save : removed conditional - replaced comparison check with false → KILLED
|
if (number.length() < 13 || number.length() > 19 || !MockPaymentGateway.luhnValid(number)) { |
|
67
|
|
throw new BusinessRuleException("Invalid card number"); |
|
68
|
|
} |
|
69
|
1
1. save : removed conditional - replaced equality check with false → KILLED
|
if (YearMonth.of(year, month).isBefore(YearMonth.now(clock))) { |
|
70
|
|
throw new BusinessRuleException("Card has expired"); |
|
71
|
|
} |
|
72
|
|
List<SavedPaymentMethod> all = mine(userId); |
|
73
|
2
1. save : changed conditional boundary → KILLED
2. save : removed conditional - replaced comparison check with false → KILLED
|
if (all.size() >= MAX) throw new ConflictException("Your wallet is full (" + MAX + " cards). Delete one first."); |
|
74
|
1
1. save : Replaced integer subtraction with addition → KILLED
|
String last4 = number.substring(number.length() - 4); |
|
75
|
|
String brand = brand(number); |
|
76
|
|
for (SavedPaymentMethod m : all) { |
|
77
|
4
1. save : removed conditional - replaced equality check with false → KILLED
2. save : removed conditional - replaced equality check with false → KILLED
3. save : removed conditional - replaced equality check with false → KILLED
4. save : removed conditional - replaced equality check with false → KILLED
|
if (m.getLast4().equals(last4) && m.getBrand().equals(brand) && m.getExpiryMonth() == month && m.getExpiryYear() == year) { |
|
78
|
|
throw new ConflictException("This card is already saved"); |
|
79
|
|
} |
|
80
|
|
} |
|
81
|
|
String token = gateway.tokenize(number); |
|
82
|
1
1. save : removed conditional - replaced equality check with false → SURVIVED
|
if (token == null) throw new BusinessRuleException("This card cannot be saved. In test mode use a Stripe test card, e.g. 4242 4242 4242 4242"); |
|
83
|
|
boolean first = all.isEmpty(); |
|
84
|
3
1. save : removed conditional - replaced equality check with false → KILLED
2. save : removed conditional - replaced equality check with false → KILLED
3. save : removed call to com/rbctcsworld/ecommerce/payment/PaymentMethodService::clearDefault → KILLED
|
if (first || makeDefault) clearDefault(all); |
|
85
|
|
SavedPaymentMethod saved = new SavedPaymentMethod(userId, brand, last4, month, year, gateway.name(), token); |
|
86
|
3
1. save : removed conditional - replaced equality check with false → SURVIVED
2. save : removed conditional - replaced equality check with false → KILLED
3. save : removed call to com/rbctcsworld/ecommerce/payment/SavedPaymentMethod::setDefault → KILLED
|
saved.setDefault(first || makeDefault); |
|
87
|
1
1. save : replaced return value with null for com/rbctcsworld/ecommerce/payment/PaymentMethodService::save → KILLED
|
return repo.save(saved); |
|
88
|
|
} |
|
89
|
|
|
|
90
|
|
public MethodResponse makeDefault(String email, long id) { |
|
91
|
|
Long userId = user(email).getId(); |
|
92
|
|
SavedPaymentMethod m = owned(id, userId); |
|
93
|
1
1. makeDefault : removed call to com/rbctcsworld/ecommerce/payment/PaymentMethodService::clearDefault → NO_COVERAGE
|
clearDefault(mine(userId)); |
|
94
|
1
1. makeDefault : removed call to com/rbctcsworld/ecommerce/payment/SavedPaymentMethod::setDefault → NO_COVERAGE
|
m.setDefault(true); |
|
95
|
1
1. makeDefault : replaced return value with null for com/rbctcsworld/ecommerce/payment/PaymentMethodService::makeDefault → NO_COVERAGE
|
return MethodResponse.from(repo.save(m), YearMonth.now(clock)); |
|
96
|
|
} |
|
97
|
|
|
|
98
|
|
public void delete(String email, long id) { |
|
99
|
|
Long userId = user(email).getId(); |
|
100
|
|
SavedPaymentMethod m = owned(id, userId); |
|
101
|
|
boolean wasDefault = m.isDefault(); |
|
102
|
1
1. delete : removed call to com/rbctcsworld/ecommerce/payment/SavedPaymentMethodRepository::delete → KILLED
|
repo.delete(m); |
|
103
|
1
1. delete : removed call to com/rbctcsworld/ecommerce/payment/SavedPaymentMethodRepository::flush → SURVIVED
|
repo.flush(); |
|
104
|
1
1. delete : removed conditional - replaced equality check with false → KILLED
|
if (wasDefault) { |
|
105
|
|
mine(userId).stream().max(Comparator.comparing(SavedPaymentMethod::getCreatedAt).thenComparing(SavedPaymentMethod::getId)) |
|
106
|
2
1. lambda$delete$1 : removed call to com/rbctcsworld/ecommerce/payment/SavedPaymentMethod::setDefault → KILLED
2. delete : removed call to java/util/Optional::ifPresent → KILLED
|
.ifPresent(next -> { next.setDefault(true); repo.save(next); }); |
|
107
|
|
} |
|
108
|
|
} |
|
109
|
|
|
|
110
|
|
/** A card of this customer, for paying; 404 for anyone else's. */ |
|
111
|
|
@Transactional(readOnly = true) |
|
112
|
|
public SavedPaymentMethod ownedBy(String email, long id) { |
|
113
|
1
1. ownedBy : replaced return value with null for com/rbctcsworld/ecommerce/payment/PaymentMethodService::ownedBy → NO_COVERAGE
|
return owned(id, user(email).getId()); |
|
114
|
|
} |
|
115
|
|
|
|
116
|
|
/** Visa 4, Mastercard 51-55 and 2221-2720, American Express 34/37, Discover 6011/65; "Card" otherwise. */ |
|
117
|
|
static String brand(String n) { |
|
118
|
2
1. brand : removed conditional - replaced equality check with false → KILLED
2. brand : replaced return value with "" for com/rbctcsworld/ecommerce/payment/PaymentMethodService::brand → KILLED
|
if (n.startsWith("4")) return "Visa"; |
|
119
|
3
1. brand : removed conditional - replaced equality check with false → KILLED
2. brand : removed conditional - replaced equality check with false → KILLED
3. brand : replaced return value with "" for com/rbctcsworld/ecommerce/payment/PaymentMethodService::brand → KILLED
|
if (n.startsWith("34") || n.startsWith("37")) return "Amex"; |
|
120
|
2
1. brand : changed conditional boundary → SURVIVED
2. brand : removed conditional - replaced comparison check with false → KILLED
|
if (n.length() >= 4) { |
|
121
|
|
int p4 = Integer.parseInt(n.substring(0, 4)); |
|
122
|
|
int p2 = Integer.parseInt(n.substring(0, 2)); |
|
123
|
9
1. brand : changed conditional boundary → SURVIVED
2. brand : changed conditional boundary → SURVIVED
3. brand : removed conditional - replaced comparison check with false → KILLED
4. brand : changed conditional boundary → KILLED
5. brand : replaced return value with "" for com/rbctcsworld/ecommerce/payment/PaymentMethodService::brand → KILLED
6. brand : removed conditional - replaced comparison check with false → KILLED
7. brand : changed conditional boundary → KILLED
8. brand : removed conditional - replaced comparison check with false → KILLED
9. brand : removed conditional - replaced comparison check with false → KILLED
|
if ((p2 >= 51 && p2 <= 55) || (p4 >= 2221 && p4 <= 2720)) return "Mastercard"; |
|
124
|
3
1. brand : removed conditional - replaced equality check with false → SURVIVED
2. brand : removed conditional - replaced equality check with false → KILLED
3. brand : replaced return value with "" for com/rbctcsworld/ecommerce/payment/PaymentMethodService::brand → KILLED
|
if (p4 == 6011 || p2 == 65) return "Discover"; |
|
125
|
|
} |
|
126
|
1
1. brand : replaced return value with "" for com/rbctcsworld/ecommerce/payment/PaymentMethodService::brand → KILLED
|
return "Card"; |
|
127
|
|
} |
|
128
|
|
|
|
129
|
|
private void clearDefault(List<SavedPaymentMethod> all) { |
|
130
|
|
for (SavedPaymentMethod m : all) { |
|
131
|
1
1. clearDefault : removed conditional - replaced equality check with false → KILLED
|
if (m.isDefault()) { |
|
132
|
1
1. clearDefault : removed call to com/rbctcsworld/ecommerce/payment/SavedPaymentMethod::setDefault → KILLED
|
m.setDefault(false); |
|
133
|
|
repo.save(m); |
|
134
|
|
} |
|
135
|
|
} |
|
136
|
1
1. clearDefault : removed call to com/rbctcsworld/ecommerce/payment/SavedPaymentMethodRepository::flush → SURVIVED
|
repo.flush(); |
|
137
|
|
} |
|
138
|
|
|
|
139
|
|
private List<SavedPaymentMethod> mine(Long userId) { |
|
140
|
1
1. mine : replaced return value with Collections.emptyList for com/rbctcsworld/ecommerce/payment/PaymentMethodService::mine → KILLED
|
return repo.findByUserIdOrderByIsDefaultDescCreatedAtDescIdDesc(userId); |
|
141
|
|
} |
|
142
|
|
|
|
143
|
|
private SavedPaymentMethod owned(long id, Long userId) { |
|
144
|
2
1. lambda$owned$2 : replaced return value with null for com/rbctcsworld/ecommerce/payment/PaymentMethodService::lambda$owned$2 → KILLED
2. owned : replaced return value with null for com/rbctcsworld/ecommerce/payment/PaymentMethodService::owned → KILLED
|
return repo.findByIdAndUserId(id, userId).orElseThrow(() -> new NotFoundException("Saved card not found: " + id)); |
|
145
|
|
} |
|
146
|
|
|
|
147
|
|
private AppUser user(String email) { |
|
148
|
2
1. lambda$user$3 : replaced return value with null for com/rbctcsworld/ecommerce/payment/PaymentMethodService::lambda$user$3 → NO_COVERAGE
2. user : replaced return value with null for com/rbctcsworld/ecommerce/payment/PaymentMethodService::user → KILLED
|
return users.findByEmail(email).orElseThrow(() -> new NotFoundException("User not found")); |
|
149
|
|
} |
|
150
|
|
} |
| | Mutations |
| 47 |
|
1.1 Location : lambda$list$0 Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:anExpiredSavedCardIsMarkedExpired()] replaced return value with null for com/rbctcsworld/ecommerce/payment/PaymentMethodService::lambda$list$0 → KILLED
2.2 Location : list Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:anExpiredSavedCardIsMarkedExpired()] replaced return value with Collections.emptyList for com/rbctcsworld/ecommerce/payment/PaymentMethodService::list → KILLED
|
| 52 |
|
1.1 Location : add Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:badExpiredAndUnusableCardsAreRefusedBeforeAnythingIsSaved()] replaced return value with null for com/rbctcsworld/ecommerce/payment/PaymentMethodService::add → KILLED
|
| 66 |
|
1.1 Location : save Killed by : none changed conditional boundary → SURVIVED
Covering tests
Covered by tests:
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:aSavedDecliningCardKeepsDeclining()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:badExpiredAndUnusableCardsAreRefusedBeforeAnythingIsSaved()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:theSameCardTwiceIsRefused()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:theWalletHoldsFiveCards()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:aNewDefaultTakesOverFromTheOldOne()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:saveAfterPaymentNeverFailsThePayment()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:deletingTheDefaultPromotesTheNewestRemainingCard()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:theFirstCardIsTheDefaultAndOnlyReceiptDataIsKept()]
2.2 Location : save Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:badExpiredAndUnusableCardsAreRefusedBeforeAnythingIsSaved()] removed conditional - replaced equality check with false → KILLED
3.3 Location : save Killed by : none changed conditional boundary → SURVIVED
Covering tests
Covered by tests:
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:aSavedDecliningCardKeepsDeclining()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:badExpiredAndUnusableCardsAreRefusedBeforeAnythingIsSaved()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:theSameCardTwiceIsRefused()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:theWalletHoldsFiveCards()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:aNewDefaultTakesOverFromTheOldOne()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:saveAfterPaymentNeverFailsThePayment()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:deletingTheDefaultPromotesTheNewestRemainingCard()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:theFirstCardIsTheDefaultAndOnlyReceiptDataIsKept()]
4.4 Location : save Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:aSavedDecliningCardKeepsDeclining()] removed conditional - replaced comparison check with false → KILLED
5.5 Location : save Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:aSavedDecliningCardKeepsDeclining()] removed conditional - replaced comparison check with false → KILLED
|
| 69 |
|
1.1 Location : save Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:badExpiredAndUnusableCardsAreRefusedBeforeAnythingIsSaved()] removed conditional - replaced equality check with false → KILLED
|
| 73 |
|
1.1 Location : save Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:theWalletHoldsFiveCards()] changed conditional boundary → KILLED
2.2 Location : save Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:theWalletHoldsFiveCards()] removed conditional - replaced comparison check with false → KILLED
|
| 74 |
|
1.1 Location : save Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:aSavedDecliningCardKeepsDeclining()] Replaced integer subtraction with addition → KILLED
|
| 77 |
|
1.1 Location : save Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:theSameCardTwiceIsRefused()] removed conditional - replaced equality check with false → KILLED
2.2 Location : save Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:theSameCardTwiceIsRefused()] removed conditional - replaced equality check with false → KILLED
3.3 Location : save Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:theSameCardTwiceIsRefused()] removed conditional - replaced equality check with false → KILLED
4.4 Location : save Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:theSameCardTwiceIsRefused()] removed conditional - replaced equality check with false → KILLED
|
| 82 |
|
1.1 Location : save Killed by : none removed conditional - replaced equality check with false → SURVIVED
Covering tests
Covered by tests:
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:aSavedDecliningCardKeepsDeclining()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:badExpiredAndUnusableCardsAreRefusedBeforeAnythingIsSaved()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:theSameCardTwiceIsRefused()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:theWalletHoldsFiveCards()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:aNewDefaultTakesOverFromTheOldOne()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:saveAfterPaymentNeverFailsThePayment()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:deletingTheDefaultPromotesTheNewestRemainingCard()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:theFirstCardIsTheDefaultAndOnlyReceiptDataIsKept()]
|
| 84 |
|
1.1 Location : save Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:aNewDefaultTakesOverFromTheOldOne()] removed conditional - replaced equality check with false → KILLED
2.2 Location : save Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:deletingTheDefaultPromotesTheNewestRemainingCard()] removed conditional - replaced equality check with false → KILLED
3.3 Location : save Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:aNewDefaultTakesOverFromTheOldOne()] removed call to com/rbctcsworld/ecommerce/payment/PaymentMethodService::clearDefault → KILLED
|
| 86 |
|
1.1 Location : save Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:aNewDefaultTakesOverFromTheOldOne()] removed conditional - replaced equality check with false → KILLED
2.2 Location : save Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:aNewDefaultTakesOverFromTheOldOne()] removed call to com/rbctcsworld/ecommerce/payment/SavedPaymentMethod::setDefault → KILLED
3.3 Location : save Killed by : none removed conditional - replaced equality check with false → SURVIVED
Covering tests
Covered by tests:
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:aSavedDecliningCardKeepsDeclining()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:badExpiredAndUnusableCardsAreRefusedBeforeAnythingIsSaved()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:theSameCardTwiceIsRefused()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:theWalletHoldsFiveCards()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:aNewDefaultTakesOverFromTheOldOne()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:saveAfterPaymentNeverFailsThePayment()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:deletingTheDefaultPromotesTheNewestRemainingCard()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:theFirstCardIsTheDefaultAndOnlyReceiptDataIsKept()]
|
| 87 |
|
1.1 Location : save Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:aSavedDecliningCardKeepsDeclining()] replaced return value with null for com/rbctcsworld/ecommerce/payment/PaymentMethodService::save → KILLED
|
| 93 |
|
1.1 Location : makeDefault Killed by : none removed call to com/rbctcsworld/ecommerce/payment/PaymentMethodService::clearDefault → NO_COVERAGE
|
| 94 |
|
1.1 Location : makeDefault Killed by : none removed call to com/rbctcsworld/ecommerce/payment/SavedPaymentMethod::setDefault → NO_COVERAGE
|
| 95 |
|
1.1 Location : makeDefault Killed by : none replaced return value with null for com/rbctcsworld/ecommerce/payment/PaymentMethodService::makeDefault → NO_COVERAGE
|
| 102 |
|
1.1 Location : delete Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:deletingTheDefaultPromotesTheNewestRemainingCard()] removed call to com/rbctcsworld/ecommerce/payment/SavedPaymentMethodRepository::delete → KILLED
|
| 103 |
|
1.1 Location : delete Killed by : none removed call to com/rbctcsworld/ecommerce/payment/SavedPaymentMethodRepository::flush → SURVIVED
Covering tests
Covered by tests:
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:deletingTheDefaultPromotesTheNewestRemainingCard()]
|
| 104 |
|
1.1 Location : delete Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:deletingTheDefaultPromotesTheNewestRemainingCard()] removed conditional - replaced equality check with false → KILLED
|
| 106 |
|
1.1 Location : lambda$delete$1 Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:deletingTheDefaultPromotesTheNewestRemainingCard()] removed call to com/rbctcsworld/ecommerce/payment/SavedPaymentMethod::setDefault → KILLED
2.2 Location : delete Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:deletingTheDefaultPromotesTheNewestRemainingCard()] removed call to java/util/Optional::ifPresent → KILLED
|
| 113 |
|
1.1 Location : ownedBy Killed by : none replaced return value with null for com/rbctcsworld/ecommerce/payment/PaymentMethodService::ownedBy → NO_COVERAGE
|
| 118 |
|
1.1 Location : brand Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:brandsFollowTheFirstDigits()] removed conditional - replaced equality check with false → KILLED
2.2 Location : brand Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:brandsFollowTheFirstDigits()] replaced return value with "" for com/rbctcsworld/ecommerce/payment/PaymentMethodService::brand → KILLED
|
| 119 |
|
1.1 Location : brand Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:brandsFollowTheFirstDigits()] removed conditional - replaced equality check with false → KILLED
2.2 Location : brand Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:brandsFollowTheFirstDigits()] removed conditional - replaced equality check with false → KILLED
3.3 Location : brand Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:brandsFollowTheFirstDigits()] replaced return value with "" for com/rbctcsworld/ecommerce/payment/PaymentMethodService::brand → KILLED
|
| 120 |
|
1.1 Location : brand Killed by : none changed conditional boundary → SURVIVED
Covering tests
Covered by tests:
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:brandsFollowTheFirstDigits()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:theWalletHoldsFiveCards()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:aNewDefaultTakesOverFromTheOldOne()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:saveAfterPaymentNeverFailsThePayment()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:deletingTheDefaultPromotesTheNewestRemainingCard()]
2.2 Location : brand Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:brandsFollowTheFirstDigits()] removed conditional - replaced comparison check with false → KILLED
|
| 123 |
|
1.1 Location : brand Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:brandsFollowTheFirstDigits()] removed conditional - replaced comparison check with false → KILLED
2.2 Location : brand Killed by : none changed conditional boundary → SURVIVED
Covering tests
Covered by tests:
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:brandsFollowTheFirstDigits()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:theWalletHoldsFiveCards()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:aNewDefaultTakesOverFromTheOldOne()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:saveAfterPaymentNeverFailsThePayment()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:deletingTheDefaultPromotesTheNewestRemainingCard()]
3.3 Location : brand Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:brandsFollowTheFirstDigits()] changed conditional boundary → KILLED
4.4 Location : brand Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:brandsFollowTheFirstDigits()] replaced return value with "" for com/rbctcsworld/ecommerce/payment/PaymentMethodService::brand → KILLED
5.5 Location : brand Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:brandsFollowTheFirstDigits()] removed conditional - replaced comparison check with false → KILLED
6.6 Location : brand Killed by : none changed conditional boundary → SURVIVED
Covering tests
Covered by tests:
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:brandsFollowTheFirstDigits()]
7.7 Location : brand Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:brandsFollowTheFirstDigits()] changed conditional boundary → KILLED
8.8 Location : brand Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:brandsFollowTheFirstDigits()] removed conditional - replaced comparison check with false → KILLED
9.9 Location : brand Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:brandsFollowTheFirstDigits()] removed conditional - replaced comparison check with false → KILLED
|
| 124 |
|
1.1 Location : brand Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:brandsFollowTheFirstDigits()] removed conditional - replaced equality check with false → KILLED
2.2 Location : brand Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:brandsFollowTheFirstDigits()] replaced return value with "" for com/rbctcsworld/ecommerce/payment/PaymentMethodService::brand → KILLED
3.3 Location : brand Killed by : none removed conditional - replaced equality check with false → SURVIVED
Covering tests
Covered by tests:
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:brandsFollowTheFirstDigits()]
|
| 126 |
|
1.1 Location : brand Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:brandsFollowTheFirstDigits()] replaced return value with "" for com/rbctcsworld/ecommerce/payment/PaymentMethodService::brand → KILLED
|
| 131 |
|
1.1 Location : clearDefault Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:aNewDefaultTakesOverFromTheOldOne()] removed conditional - replaced equality check with false → KILLED
|
| 132 |
|
1.1 Location : clearDefault Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:aNewDefaultTakesOverFromTheOldOne()] removed call to com/rbctcsworld/ecommerce/payment/SavedPaymentMethod::setDefault → KILLED
|
| 136 |
|
1.1 Location : clearDefault Killed by : none removed call to com/rbctcsworld/ecommerce/payment/SavedPaymentMethodRepository::flush → SURVIVED
Covering tests
Covered by tests:
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:aSavedDecliningCardKeepsDeclining()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:badExpiredAndUnusableCardsAreRefusedBeforeAnythingIsSaved()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:theSameCardTwiceIsRefused()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:theWalletHoldsFiveCards()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:aNewDefaultTakesOverFromTheOldOne()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:saveAfterPaymentNeverFailsThePayment()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:deletingTheDefaultPromotesTheNewestRemainingCard()]
- com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:theFirstCardIsTheDefaultAndOnlyReceiptDataIsKept()]
|
| 140 |
|
1.1 Location : mine Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:anExpiredSavedCardIsMarkedExpired()] replaced return value with Collections.emptyList for com/rbctcsworld/ecommerce/payment/PaymentMethodService::mine → KILLED
|
| 144 |
|
1.1 Location : lambda$owned$2 Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:somebodyElsesCardDoesNotExist()] replaced return value with null for com/rbctcsworld/ecommerce/payment/PaymentMethodService::lambda$owned$2 → KILLED
2.2 Location : owned Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:deletingTheDefaultPromotesTheNewestRemainingCard()] replaced return value with null for com/rbctcsworld/ecommerce/payment/PaymentMethodService::owned → KILLED
|
| 148 |
|
1.1 Location : lambda$user$3 Killed by : none replaced return value with null for com/rbctcsworld/ecommerce/payment/PaymentMethodService::lambda$user$3 → NO_COVERAGE
2.2 Location : user Killed by : com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.payment.PaymentMethodServiceTest]/[method:anExpiredSavedCardIsMarkedExpired()] replaced return value with null for com/rbctcsworld/ecommerce/payment/PaymentMethodService::user → KILLED
|