@Test public void extractUserNoUserService() { Optional<CurrentCoffeeNetUser> coffeeNetWebUser = sut.extractUser(); assertThat(coffeeNetWebUser).isSameAs(Optional.empty()); }
Optional<CurrentCoffeeNetUser> extractUser() { Optional<CurrentCoffeeNetUser> coffeeNetWebUser = Optional.empty(); Optional<CoffeeNetCurrentUserService> userService = getCoffeeNetCurrentUserService(); if (userService.isPresent()) { Optional<CoffeeNetUserDetails> coffeeNetUserDetails = userService.get().get(); if (coffeeNetUserDetails.isPresent()) { String username = coffeeNetUserDetails.get().getUsername(); String email = coffeeNetUserDetails.get().getEmail(); coffeeNetWebUser = Optional.of(new CurrentCoffeeNetUser(username, email)); } } return coffeeNetWebUser; }
CoffeeNetNavigationDataExtractor { Optional<CurrentCoffeeNetUser> extractUser() { Optional<CurrentCoffeeNetUser> coffeeNetWebUser = Optional.empty(); Optional<CoffeeNetCurrentUserService> userService = getCoffeeNetCurrentUserService(); if (userService.isPresent()) { Optional<CoffeeNetUserDetails> coffeeNetUserDetails = userService.get().get(); if (coffeeNetUserDetails.isPresent()) { String username = coffeeNetUserDetails.get().getUsername(); String email = coffeeNetUserDetails.get().getEmail(); coffeeNetWebUser = Optional.of(new CurrentCoffeeNetUser(username, email)); } } return coffeeNetWebUser; } }
CoffeeNetNavigationDataExtractor { Optional<CurrentCoffeeNetUser> extractUser() { Optional<CurrentCoffeeNetUser> coffeeNetWebUser = Optional.empty(); Optional<CoffeeNetCurrentUserService> userService = getCoffeeNetCurrentUserService(); if (userService.isPresent()) { Optional<CoffeeNetUserDetails> coffeeNetUserDetails = userService.get().get(); if (coffeeNetUserDetails.isPresent()) { String username = coffeeNetUserDetails.get().getUsername(); String email = coffeeNetUserDetails.get().getEmail(); coffeeNetWebUser = Optional.of(new CurrentCoffeeNetUser(username, email)); } } return coffeeNetWebUser; } CoffeeNetNavigationDataExtractor(CoffeeNetNavigationProperties coffeeNetNavigationProperties); }
CoffeeNetNavigationDataExtractor { Optional<CurrentCoffeeNetUser> extractUser() { Optional<CurrentCoffeeNetUser> coffeeNetWebUser = Optional.empty(); Optional<CoffeeNetCurrentUserService> userService = getCoffeeNetCurrentUserService(); if (userService.isPresent()) { Optional<CoffeeNetUserDetails> coffeeNetUserDetails = userService.get().get(); if (coffeeNetUserDetails.isPresent()) { String username = coffeeNetUserDetails.get().getUsername(); String email = coffeeNetUserDetails.get().getEmail(); coffeeNetWebUser = Optional.of(new CurrentCoffeeNetUser(username, email)); } } return coffeeNetWebUser; } CoffeeNetNavigationDataExtractor(CoffeeNetNavigationProperties coffeeNetNavigationProperties);  }
CoffeeNetNavigationDataExtractor { Optional<CurrentCoffeeNetUser> extractUser() { Optional<CurrentCoffeeNetUser> coffeeNetWebUser = Optional.empty(); Optional<CoffeeNetCurrentUserService> userService = getCoffeeNetCurrentUserService(); if (userService.isPresent()) { Optional<CoffeeNetUserDetails> coffeeNetUserDetails = userService.get().get(); if (coffeeNetUserDetails.isPresent()) { String username = coffeeNetUserDetails.get().getUsername(); String email = coffeeNetUserDetails.get().getEmail(); coffeeNetWebUser = Optional.of(new CurrentCoffeeNetUser(username, email)); } } return coffeeNetWebUser; } CoffeeNetNavigationDataExtractor(CoffeeNetNavigationProperties coffeeNetNavigationProperties);   }