@Test public void emptyAuthentication() { Optional<CoffeeNetUserDetails> coffeeNetUserDetails = sut.get(); assertThat(coffeeNetUserDetails.isPresent(), is(false)); }
@Override public Optional<CoffeeNetUserDetails> get() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (authentication == null) { return Optional.empty(); } User user = (User) authentication.getPrincipal(); return getCoffeeNetUserDetails(user); }
DevelopmentCoffeeNetCurrentUserService implements CoffeeNetCurrentUserService { @Override public Optional<CoffeeNetUserDetails> get() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (authentication == null) { return Optional.empty(); } User user = (User) authentication.getPrincipal(); return getCoffeeNetUserDetails(user); } }
DevelopmentCoffeeNetCurrentUserService implements CoffeeNetCurrentUserService { @Override public Optional<CoffeeNetUserDetails> get() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (authentication == null) { return Optional.empty(); } User user = (User) authentication.getPrincipal(); return getCoffeeNetUserDetails(user); }  }
DevelopmentCoffeeNetCurrentUserService implements CoffeeNetCurrentUserService { @Override public Optional<CoffeeNetUserDetails> get() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (authentication == null) { return Optional.empty(); } User user = (User) authentication.getPrincipal(); return getCoffeeNetUserDetails(user); }  @Override Optional<CoffeeNetUserDetails> get(); }
DevelopmentCoffeeNetCurrentUserService implements CoffeeNetCurrentUserService { @Override public Optional<CoffeeNetUserDetails> get() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (authentication == null) { return Optional.empty(); } User user = (User) authentication.getPrincipal(); return getCoffeeNetUserDetails(user); }  @Override Optional<CoffeeNetUserDetails> get();  }