@Test(expected = NullPointerException.class) public void should_not_generate_token_when_oauthid_is_null() { tokenService.generateNewToken(new Account()); }
public void generateNewToken(Account account) { Objects.requireNonNull(account); Objects.requireNonNull(account.getOauthId()); account.setToken(UUID.randomUUID().toString()); reinitTokenValidity(account); }
TokenService { public void generateNewToken(Account account) { Objects.requireNonNull(account); Objects.requireNonNull(account.getOauthId()); account.setToken(UUID.randomUUID().toString()); reinitTokenValidity(account); } }
TokenService { public void generateNewToken(Account account) { Objects.requireNonNull(account); Objects.requireNonNull(account.getOauthId()); account.setToken(UUID.randomUUID().toString()); reinitTokenValidity(account); }  }
TokenService { public void generateNewToken(Account account) { Objects.requireNonNull(account); Objects.requireNonNull(account.getOauthId()); account.setToken(UUID.randomUUID().toString()); reinitTokenValidity(account); }  void generateNewToken(Account account); void reinitTokenValidity(Account account); Account checkToken(String token); Account getCredentialsForToken(String token); Member tryToLinkWithActualMember(Account account); }
TokenService { public void generateNewToken(Account account) { Objects.requireNonNull(account); Objects.requireNonNull(account.getOauthId()); account.setToken(UUID.randomUUID().toString()); reinitTokenValidity(account); }  void generateNewToken(Account account); void reinitTokenValidity(Account account); Account checkToken(String token); Account getCredentialsForToken(String token); Member tryToLinkWithActualMember(Account account);  }