All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.mockito.ThrowingConsumer Maven / Gradle / Ivy

There is a newer version: 5.14.2
Show newest version
/*
 * Copyright (c) 2023 Mockito contributors
 * This program is made available under the terms of the MIT License.
 */
package org.mockito;

import java.util.function.Consumer;

@SuppressWarnings("FunctionalInterfaceMethodChanged")
@FunctionalInterface
public interface ThrowingConsumer extends Consumer {
    @Override
    default void accept(final T input) {
        try {
            acceptThrows(input);
        } catch (final RuntimeException | AssertionError e) {
            throw e;
        } catch (Throwable e) {
            throw new RuntimeException(e);
        }
    }

    void acceptThrows(T input) throws Throwable;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy