<commit_before>/*
 *  Copyright (C) 2013 mgm technology partners GmbH, Munich.
 *
 *  See the LICENSE file distributed with this work for additional
 *  information regarding copyright ownership and intellectual property rights.
 */
package com.mgmtp.jfunk.web.util;

import org.openqa.selenium.TimeoutException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.common.base.Function;
import com.google.common.base.Predicate;

/**
 * {@link WebDriverWait} decendant that writes a log message before {@link #until(Function)} or
 * {@link #until(Predicate)} is called.
 * 
 * @author rnaegele
 */
public class LoggingWebDriverWait extends WebDriverWait {

	private final Logger log = LoggerFactory.getLogger(getClass());

	public LoggingWebDriverWait(final WebDriver driver, final long timeOutInSeconds) {
		super(driver, timeOutInSeconds);
	}

	public LoggingWebDriverWait(final WebDriver driver, final long timeOutInSeconds, final long sleepInMillis) {
		super(driver, timeOutInSeconds, sleepInMillis);
	}

	@Override
	public <V> V until(final Function<? super WebDriver, V> function) {
		try {
			V result = super.until(function);
			log.info("Successfully waited for: {}", function);
			return result;
		} catch (TimeoutException ex) {
			log.error("Error waiting for: {}", function);
			throw ex;
		}
	}

	@Override
	public void until(final Predicate<WebDriver> predicate) {
		try {
			super.until(predicate);
			log.info("Successfully waited for: {}", predicate);
		} catch (TimeoutException ex) {
			log.error("Error waiting for: {}", predicate);
			throw ex;
		}
	}
}<commit_msg>MQA-463: Predicates were logged twice.<commit_after>/*
 *  Copyright (C) 2013 mgm technology partners GmbH, Munich.
 *
 *  See the LICENSE file distributed with this work for additional
 *  information regarding copyright ownership and intellectual property rights.
 */
package com.mgmtp.jfunk.web.util;

import org.openqa.selenium.TimeoutException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.common.base.Function;
import com.google.common.base.Predicate;

/**
 * {@link WebDriverWait} decendant that writes a log message before {@link #until(Function)} or
 * {@link #until(Predicate)} is called.
 * 
 * @author rnaegele
 */
public class LoggingWebDriverWait extends WebDriverWait {

	private final Logger log = LoggerFactory.getLogger(getClass());

	public LoggingWebDriverWait(final WebDriver driver, final long timeOutInSeconds) {
		super(driver, timeOutInSeconds);
	}

	public LoggingWebDriverWait(final WebDriver driver, final long timeOutInSeconds, final long sleepInMillis) {
		super(driver, timeOutInSeconds, sleepInMillis);
	}

	@Override
	public <V> V until(final Function<? super WebDriver, V> function) {
		try {
			V result = super.until(function);
			log.info("Successfully waited for: {}", function);
			return result;
		} catch (TimeoutException ex) {
			log.error("Error waiting for: {}", function);
			throw ex;
		}
	}
}
{'fraction_non_alphanumeric': 0.10777496839443743, 'fraction_numerical': 0.004740834386852086, 'mean_word_length': 4.850277264325324, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, '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': '5109157', 'n_tokens_mistral': 1013, 'n_tokens_neox': 943, 'n_words': 269}