feat: ExchangeController & tests
This commit is contained in:
parent
720937bd6c
commit
95ed5f6ae7
8 changed files with 85 additions and 21 deletions
|
@ -2,6 +2,7 @@ package eu.ztsh.wymiana.service;
|
|||
|
||||
import eu.ztsh.wymiana.exception.ExchangeFailedException;
|
||||
import eu.ztsh.wymiana.exception.InsufficientFundsException;
|
||||
import eu.ztsh.wymiana.exception.UserNotFoundException;
|
||||
import eu.ztsh.wymiana.model.Currency;
|
||||
import eu.ztsh.wymiana.model.User;
|
||||
import eu.ztsh.wymiana.validation.InstanceValidator;
|
||||
|
@ -49,7 +50,7 @@ public class CurrencyService {
|
|||
user.currencies().putAll(exchanged);
|
||||
return userService.update(user);
|
||||
})
|
||||
.orElseThrow(ExchangeFailedException::new);
|
||||
.orElseThrow(() -> new UserNotFoundException(request));
|
||||
}
|
||||
|
||||
private Currency create(String symbol) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue