Подключил Spring Boot и добавил API получения операций с обработкой 404 и HTTP-тестом
This commit is contained in:
1 parent
70f61cdc64
commit
cd404fae0b
11 files changed
+194
-12
No files matched your search
@@ -44,6 +44,10 @@ public class OperationService {
|
||||
return ledger.isPosted(operation.getId());
|
||||
}
|
||||
|
||||
public Operation getById(Long operationId) {
|
||||
return requiredOperation(operationId);
|
||||
}
|
||||
|
||||
private Operation requiredOperation(Long operationId) {
|
||||
|
||||
if (operationId == null) {
|
||||
@@ -53,9 +57,7 @@ public class OperationService {
|
||||
Operation operation = journal.getOperationById(operationId);
|
||||
|
||||
if (operation == null) {
|
||||
throw new IllegalArgumentException(
|
||||
"Операция не найдена: " + operationId
|
||||
);
|
||||
throw new OperationNotFoundException(operationId);
|
||||
}
|
||||
return operation;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user