@Test void getByIdWithListsInTransactionNotFound() { when(stackRepository.findOneWithLists(STACK_ID)).thenReturn(Optional.empty()); NotFoundException notFoundException = assertThrows(NotFoundException.class, () -> underTest.getByIdWithListsInTransaction(STACK_ID)); assertEquals("Stack [" + STACK_ID + "] not found", notFoundException.getMessage()); }
public Stack getByIdWithListsInTransaction(Long id) { return stackRepository.findOneWithLists(id).orElseThrow(() -> new NotFoundException(String.format("Stack [%s] not found", id))); }
StackService implements ResourceBasedCrnProvider { public Stack getByIdWithListsInTransaction(Long id) { return stackRepository.findOneWithLists(id).orElseThrow(() -> new NotFoundException(String.format("Stack [%s] not found", id))); } }
StackService implements ResourceBasedCrnProvider { public Stack getByIdWithListsInTransaction(Long id) { return stackRepository.findOneWithLists(id).orElseThrow(() -> new NotFoundException(String.format("Stack [%s] not found", id))); }  }
StackService implements ResourceBasedCrnProvider { public Stack getByIdWithListsInTransaction(Long id) { return stackRepository.findOneWithLists(id).orElseThrow(() -> new NotFoundException(String.format("Stack [%s] not found", id))); }  List<Stack> findAllRunning(); List<Stack> findAllForAutoSync(); Stack getByIdWithListsInTransaction(Long id); Stack getStackById(Long id); Stack save(Stack stack); Stack getByEnvironmentCrnAndAccountId(String environmentCrn, String accountId); Optional<Stack> findByEnvironmentCrnAndAccountId(String environmentCrn, String accountId); Stack getByEnvironmentCrnAndAccountIdEvenIfTerminated(String environmentCrn, String accountId); Optional<Stack> findByEnvironmentCrnAndAccountIdEvenIfTerminated(String environmentCrn, String accountId); List<Stack> getMultipleByEnvironmentCrnOrChildEnvironmantCrnAndAccountId(Collection<String> environmentCrns, String accountId); List<Stack> findAllByEnvironmentCrnAndAccountId(String environmentCrn, String accountId); List<Long> findAllIdByEnvironmentCrnAndAccountId(String environmentCrn, String accountId); Stack getByEnvironmentCrnAndAccountIdWithLists(String environmentCrn, String accountId); Stack getByOwnEnvironmentCrnAndAccountIdWithLists(String environmentCrn, String accountId); List<Stack> getAllByAccountId(String accountId); List<StackIdWithStatus> getStatuses(Set<Long> stackIds); List<Stack> findAllWithStatuses(Collection<Status> statuses); List<Stack> findAllByAccountIdWithStatuses(String accountId, Collection<Status> statuses); List<Stack> findMultipleByEnvironmentCrnAndAccountIdWithStatuses(Collection<String> environmentCrns, String accountId, Collection<Status> statuses); @Override List<String> getResourceCrnsInAccount(); @Override AuthorizationResourceType getResourceType(); }
StackService implements ResourceBasedCrnProvider { public Stack getByIdWithListsInTransaction(Long id) { return stackRepository.findOneWithLists(id).orElseThrow(() -> new NotFoundException(String.format("Stack [%s] not found", id))); }  List<Stack> findAllRunning(); List<Stack> findAllForAutoSync(); Stack getByIdWithListsInTransaction(Long id); Stack getStackById(Long id); Stack save(Stack stack); Stack getByEnvironmentCrnAndAccountId(String environmentCrn, String accountId); Optional<Stack> findByEnvironmentCrnAndAccountId(String environmentCrn, String accountId); Stack getByEnvironmentCrnAndAccountIdEvenIfTerminated(String environmentCrn, String accountId); Optional<Stack> findByEnvironmentCrnAndAccountIdEvenIfTerminated(String environmentCrn, String accountId); List<Stack> getMultipleByEnvironmentCrnOrChildEnvironmantCrnAndAccountId(Collection<String> environmentCrns, String accountId); List<Stack> findAllByEnvironmentCrnAndAccountId(String environmentCrn, String accountId); List<Long> findAllIdByEnvironmentCrnAndAccountId(String environmentCrn, String accountId); Stack getByEnvironmentCrnAndAccountIdWithLists(String environmentCrn, String accountId); Stack getByOwnEnvironmentCrnAndAccountIdWithLists(String environmentCrn, String accountId); List<Stack> getAllByAccountId(String accountId); List<StackIdWithStatus> getStatuses(Set<Long> stackIds); List<Stack> findAllWithStatuses(Collection<Status> statuses); List<Stack> findAllByAccountIdWithStatuses(String accountId, Collection<Status> statuses); List<Stack> findMultipleByEnvironmentCrnAndAccountIdWithStatuses(Collection<String> environmentCrns, String accountId, Collection<Status> statuses); @Override List<String> getResourceCrnsInAccount(); @Override AuthorizationResourceType getResourceType();  }