info.solidsoft.mockito.java8.ThrowingPredicate 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.Predicate;
import static info.solidsoft.mockito.java8.SneakyThrow.sneakyRethrow;
@FunctionalInterface
@Incubating
public interface ThrowingPredicate {
boolean test(T t) throws Exception;
default Predicate uncheck() {
return t -> {
try {
return this.test(t);
} catch (Exception e) {
return sneakyRethrow(e);
}
};
}
}