public void validate() {
        if (lazyLogin) {
            return;
        }
        ObjectHelper.notNull(loginUrl, "loginUrl");
        ObjectHelper.notNull(clientId, "clientId");

        final AuthenticationType type = getType();

        switch (type) {
            case USERNAME_PASSWORD:
                ObjectHelper.notNull(userName, "userName (username/password authentication)");
                ObjectHelper.notNull(password, "password (username/password authentication)");
                ObjectHelper.notNull(clientSecret, "clientSecret (username/password authentication)");
                break;
            case REFRESH_TOKEN:
                ObjectHelper.notNull(refreshToken, "refreshToken (authentication with refresh token)");
                ObjectHelper.notNull(clientSecret, "clientSecret (authentication with refresh token)");
                break;
            case JWT:
                ObjectHelper.notNull(userName, "userName (JWT authentication)");
                ObjectHelper.notNull(keystore, "keystore (JWT authentication)");
                break;
            case CLIENT_CREDENTIALS:
                ObjectHelper.notNull(clientSecret, "clientSecret (Client Credentials authentication)");
                break;
            default:
                throw new IllegalArgumentException("Unknown authentication type: " + type);
        }
    }
@Test
    public void shouldValidateRefreshTokenParameters() {
        refreshToken.validate();
    }