<commit_before>package org.osiam.client.oauth;

import org.junit.Test;
import org.osiam.client.exception.ConnectionInitializationException;

import java.net.URI;
import java.net.URISyntaxException;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

public class AuthServiceBuilderTest {

    private static final String IRRELEVANT = "irrelevant";

    @Test
    public void valid_parameters_produce_a_working_authservice() throws Exception {
        AuthService as = new AuthService.Builder(IRRELEVANT).withGrantType(GrantType.PASSWORD)
                .withClientId(IRRELEVANT)
                .withClientSecret(IRRELEVANT)
                .withUsername(IRRELEVANT)
                .withPassword(<PASSWORD>)
                .build();
        assertEquals(new URI(IRRELEVANT + "/oauth/token"), as.getUri());
    }

    @Test(expected = UnsupportedOperationException.class)
    public void wrong_grant_type_raises_exception() {
        new AuthService.Builder(IRRELEVANT).withGrantType(GrantType.CLIENT_CREDENTIALS);
        fail("We expected an exception");
    }

    @Test(expected = ConnectionInitializationException.class)
    public void missing_client_secret_raises_exception() {<commit_msg>Spelling fix<commit_after>package org.osiam.client.oauth;

import org.junit.Test;
import org.osiam.client.exception.ConnectionInitializationException;

import java.net.URI;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;

public class AuthServiceBuilderTest {

    private static final String IRRELEVANT = "irrelevant";

    @Test
    public void valid_parameters_produces_a_working_authservice() throws Exception {
        AuthService as = new AuthService.Builder(IRRELEVANT).withGrantType(GrantType.PASSWORD)
                .withClientId(IRRELEVANT)
                .withClientSecret(IRRELEVANT)
                .withUsername(IRRELEVANT)
                .withPassword(<PASSWORD>)
                .build();
        assertEquals(new URI(IRRELEVANT + "/oauth/token"), as.getUri());
    }

    @Test(expected = UnsupportedOperationException.class)
    public void wrong_grant_type_raises_exception() {
        new AuthService.Builder(IRRELEVANT).withGrantType(GrantType.CLIENT_CREDENTIALS);
        fail("We expected an exception");
    }

    @Test(expected = ConnectionInitializationException.class)
    public void missing_client_secret_raises_exception() {
{'fraction_non_alphanumeric': 0.08877178759627077, 'fraction_numerical': 0.0, 'mean_word_length': 3.692015209125475, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4153494', 'n_tokens_mistral': 724, 'n_tokens_neox': 680, 'n_words': 122}