<commit_before>package rocketboardPages;

import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;

/**
 * Created by gmatheu on 16/01/15.
 */
public class GitHub {
    public static class AuthenticatePage {
        private WebDriver driver;

        @FindBy(id = "login_field")
        WebElement username;

        @FindBy(id = "password")
        WebElement password;

        @FindBy(name = "commit")
        WebElement submit;

        public AuthenticatePage(WebDriver driver) {
            this.driver = driver;
        }

        public AuthorizePage login() {
            username.sendKeys(System.getenv("TABLERO_TEST_USER"));
            password.sendKeys(<PASSWORD>("<PASSWORD>"));
            submit.click();

            return PageFactory.initElements(driver, AuthorizePage.class);
        }
    }

    public static class AuthorizePage {
        private WebDriver driver;

        public AuthorizePage(WebDriver driver) {
            this.driver = driver;
        }

        public void authorizeIfNeeded(){
            try {
                authorize();
            } catch (NoSuchElementException e) {
                //No authorization required
            }
        }
<commit_msg>Throwing exception when env var is not found<commit_after>package rocketboardPages;

import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;

/**
 * Created by gmatheu on 16/01/15.
 */
public class GitHub {
    public static class AuthenticatePage {
        private WebDriver driver;

        @FindBy(id = "login_field")
        WebElement username;

        @FindBy(id = "password")
        WebElement password;

        @FindBy(name = "commit")
        WebElement submit;

        public AuthenticatePage(WebDriver driver) {
            this.driver = driver;
        }

        public AuthorizePage login() {
            username.sendKeys(getEnv("TABLERO_TEST_USER"));
            password.sendKeys(<PASSWORD>("<PASSWORD>"));
            submit.click();

            return PageFactory.initElements(driver, AuthorizePage.class);
        }

        private static String getEnv(String key) {
            String value = System.getenv(key);

            if(value == null) {
                throw new IllegalStateException(String.format("Could not find environment variable value: %s", key));
            }

            return value;
        }
    }

    public static class AuthorizePage {
        private WebDriver driver;

        public AuthorizePage(WebDriver driver) {
            this.driver = driver;
        }

        public void authorizeIfNeeded(){
            try {
                authorize();
            } catch (NoSuchElementException e) {
                //No authorization required
            }
        }

{'fraction_non_alphanumeric': 0.0919909938887102, 'fraction_numerical': 0.0038597619813444837, 'mean_word_length': 2.179959100204499, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '5631816', 'n_tokens_mistral': 875, 'n_tokens_neox': 816, 'n_words': 185}