@Test(expected = TokenUpdateException.class) public void test_should_return_false_when_token_is_not_updated_successfully() { final Token token = Token.builder().uuid("uuid").build(); tokenRepository.markAsValidated(token); }
public Token markAsValidated(Token token) { token.setValidated(true); final boolean isUpdateSuccessful = markTokenAsValidated(token.getUuid()) == UPDATED_ROWS_COUNT; if (!isUpdateSuccessful) { throw new TokenUpdateException(token); } return token; }
TokenRepository { public Token markAsValidated(Token token) { token.setValidated(true); final boolean isUpdateSuccessful = markTokenAsValidated(token.getUuid()) == UPDATED_ROWS_COUNT; if (!isUpdateSuccessful) { throw new TokenUpdateException(token); } return token; } }
TokenRepository { public Token markAsValidated(Token token) { token.setValidated(true); final boolean isUpdateSuccessful = markTokenAsValidated(token.getUuid()) == UPDATED_ROWS_COUNT; if (!isUpdateSuccessful) { throw new TokenUpdateException(token); } return token; } TokenRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate); }
TokenRepository { public Token markAsValidated(Token token) { token.setValidated(true); final boolean isUpdateSuccessful = markTokenAsValidated(token.getUuid()) == UPDATED_ROWS_COUNT; if (!isUpdateSuccessful) { throw new TokenUpdateException(token); } return token; } TokenRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate); Token save(Token token); Token markAsValidated(Token token); Tokens findByNumberAndIdentityAndTenantId(ValidateRequest request); Tokens findByNumberAndIdentityAndTenantIdLike(ValidateRequest request); Token findBy(TokenSearchCriteria searchCriteria); }
TokenRepository { public Token markAsValidated(Token token) { token.setValidated(true); final boolean isUpdateSuccessful = markTokenAsValidated(token.getUuid()) == UPDATED_ROWS_COUNT; if (!isUpdateSuccessful) { throw new TokenUpdateException(token); } return token; } TokenRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate); Token save(Token token); Token markAsValidated(Token token); Tokens findByNumberAndIdentityAndTenantId(ValidateRequest request); Tokens findByNumberAndIdentityAndTenantIdLike(ValidateRequest request); Token findBy(TokenSearchCriteria searchCriteria);  }