@Test public void testGetById() { when(dbStackRepository.findById(1L)).thenReturn(Optional.of(dbStack)); assertEquals(dbStack, underTest.getById(1L)); }
public DBStack getById(Long id) { return dbStackRepository.findById(id).orElseThrow(() -> new NotFoundException(String.format("Stack [%s] not found", id))); }
DBStackService { public DBStack getById(Long id) { return dbStackRepository.findById(id).orElseThrow(() -> new NotFoundException(String.format("Stack [%s] not found", id))); } }
DBStackService { public DBStack getById(Long id) { return dbStackRepository.findById(id).orElseThrow(() -> new NotFoundException(String.format("Stack [%s] not found", id))); }  }
DBStackService { public DBStack getById(Long id) { return dbStackRepository.findById(id).orElseThrow(() -> new NotFoundException(String.format("Stack [%s] not found", id))); }  DBStack getById(Long id); Optional<DBStack> findById(Long id); DBStack getByNameAndEnvironmentCrn(String name, String environmentCrn); Optional<DBStack> findByNameAndEnvironmentCrn(String name, String environmentCrn); DBStack getByCrn(String crn); Optional<DBStack> getByCrn(Crn crn); Set<Long> findAllDeleting(); Set<Long> findAllDeletingById(Set<Long> dbStackIds); Set<DBStack> findAllForAutoSync(); DBStack save(DBStack dbStack); @Transactional void delete(DBStack dbStack); @Transactional void delete(Long dbStackId); }
DBStackService { public DBStack getById(Long id) { return dbStackRepository.findById(id).orElseThrow(() -> new NotFoundException(String.format("Stack [%s] not found", id))); }  DBStack getById(Long id); Optional<DBStack> findById(Long id); DBStack getByNameAndEnvironmentCrn(String name, String environmentCrn); Optional<DBStack> findByNameAndEnvironmentCrn(String name, String environmentCrn); DBStack getByCrn(String crn); Optional<DBStack> getByCrn(Crn crn); Set<Long> findAllDeleting(); Set<Long> findAllDeletingById(Set<Long> dbStackIds); Set<DBStack> findAllForAutoSync(); DBStack save(DBStack dbStack); @Transactional void delete(DBStack dbStack); @Transactional void delete(Long dbStackId);  }