Skip to content

Commit

Permalink
Fait passer le test
Browse files Browse the repository at this point in the history
  • Loading branch information
hal91190 committed Oct 25, 2017
1 parent 0f38c87 commit 94f3173
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/java/fr/uvsq/poo/compte/Account.java
Original file line number Diff line number Diff line change
@@ -62,6 +62,9 @@ public void debit(BigDecimal amount) {
* @throws IllegalArgumentException si le montant à transférer est négatif ou s'il est supérieur au solde du compte source
*/
public void transfer(BigDecimal amount, Account targetAccount) {
if (targetAccount == this) {
throw new IllegalArgumentException("Virement d'un compte sur lui-même");
}
debit(amount);
targetAccount.credit(amount);
}

0 comments on commit 94f3173

Please sign in to comment.