BasketController { @SuppressWarnings("WeakerAccess") @GetMapping("/baskets/{id}") BasketModel one(@PathVariable UUID id) throws BasketNotFoundException { Optional<BasketModel> basket = basketRepository.findById(id); return basket.orElseThrow(BasketNotFoundException::new); } @Autowired  BasketController(BasketRepository basketRepository);   }
@Test(expected = BasketNotFoundException.class) public void oneUnknown() { basketController.one(UUID.randomUUID()); }