Refactored the Functional Interface to the Specialized Functional

Interface.
This commit is contained in:
Harshrajsinh Thakor 2017-06-09 17:17:56 -07:00
parent f87249e03b
commit 73934e25e5

View File

@ -28,6 +28,8 @@ import static org.junit.Assert.assertNotNull;
import java.util.ArrayList;
import java.util.List;
import java.util.function.BiFunction;
import java.util.function.IntBinaryOperator;
import org.junit.Test;
/**
@ -45,14 +47,14 @@ public abstract class ExpressionTest<E extends Expression> {
* @param resultCalc The function used to calculate the expected result
* @return A data set with test entries
*/
static List<Object[]> prepareParameters(final BiFunction<Integer, Integer, Integer> resultCalc) {
static List<Object[]> prepareParameters(final IntBinaryOperator resultCalc) {
final List<Object[]> testData = new ArrayList<>();
for (int i = -10; i < 10; i++) {
for (int j = -10; j < 10; j++) {
testData.add(new Object[]{
new NumberExpression(i),
new NumberExpression(j),
resultCalc.apply(i, j)
resultCalc.applyAsInt(i, j)
});
}
}