@Test public void whenProfileDoesNotExists() { PlayerProfileRepository repository = mock(PlayerProfileRepository.class); Ranks ranks = mock(Ranks.class); PlayerProfileLoader loader = new PlayerProfileLoader(repository, ranks); PlayerProfile profile = mock(PlayerProfile.class); Rank rank = mock(Rank.class); when(rank.getId()).thenReturn(1); when(ranks.getRankSingleton(eq(1))).thenReturn(rank); when(profile.getName()).thenReturn("name"); when(profile.getRank()).thenReturn(rank); when(repository.find(any(), any())).thenReturn(Optional.of(profile)); LoginDetails loginDetails = new LoginDetails(profile.getUuid(), "name"); loader.proceed(loginDetails); verify(profile).setRank(eq(rank)); verify(repository).put(eq(profile.getUuid()), eq(profile)); }
@Override public void proceed(LoginDetails loginDetails) { try { log.info("Processing {}", loginDetails.getName()); attemptProcessing(loginDetails); super.proceedNext(loginDetails); } catch (PersistenceException e) { throw new LoginProcessingException(e); } }
PlayerProfileLoader extends LoginChainLink { @Override public void proceed(LoginDetails loginDetails) { try { log.info("Processing {}", loginDetails.getName()); attemptProcessing(loginDetails); super.proceedNext(loginDetails); } catch (PersistenceException e) { throw new LoginProcessingException(e); } } }
PlayerProfileLoader extends LoginChainLink { @Override public void proceed(LoginDetails loginDetails) { try { log.info("Processing {}", loginDetails.getName()); attemptProcessing(loginDetails); super.proceedNext(loginDetails); } catch (PersistenceException e) { throw new LoginProcessingException(e); } }  }
PlayerProfileLoader extends LoginChainLink { @Override public void proceed(LoginDetails loginDetails) { try { log.info("Processing {}", loginDetails.getName()); attemptProcessing(loginDetails); super.proceedNext(loginDetails); } catch (PersistenceException e) { throw new LoginProcessingException(e); } }  @Override void proceed(LoginDetails loginDetails); }
PlayerProfileLoader extends LoginChainLink { @Override public void proceed(LoginDetails loginDetails) { try { log.info("Processing {}", loginDetails.getName()); attemptProcessing(loginDetails); super.proceedNext(loginDetails); } catch (PersistenceException e) { throw new LoginProcessingException(e); } }  @Override void proceed(LoginDetails loginDetails);  }