info.solidsoft.mockito.java8.ThrowingConsumer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mockito-java8 Show documentation
Show all versions of mockito-java8 Show documentation
Mockito add-ons leveraging Java 8 and lambda expressions to make mocking even more compact
The newest version!
/*
* Copyright (C) 2018 Mockito contributors.
*
* Licensed under the Apache License, Version 2.0.
*/
package info.solidsoft.mockito.java8;
import org.mockito.Incubating;
import java.util.function.Consumer;
import static info.solidsoft.mockito.java8.SneakyThrow.sneakyRethrow;
@FunctionalInterface
@Incubating
public interface ThrowingConsumer {
void accept(T t) throws Exception;
default Consumer uncheck() {
return t -> {
try {
this.accept(t);
} catch (Exception e) {
sneakyRethrow(e);
}
};
}
}