use of org.junit.function.ThrowingRunnable in project aerospike-client-java by aerospike.
the class TestFilterExp method filterIntNot.
@Test
public void filterIntNot() {
Policy policy = new Policy();
policy.filterExp = Exp.build(Exp.not(Exp.eq(Exp.intNot(Exp.intBin(binA)), Exp.val(-2))));
policy.failOnFilteredOut = true;
AerospikeException ae = assertThrows(AerospikeException.class, new ThrowingRunnable() {
public void run() {
client.get(policy, keyA);
}
});
assertEquals(ResultCode.FILTERED_OUT, ae.getResultCode());
policy.filterExp = Exp.build(Exp.eq(Exp.intNot(Exp.intBin(binA)), Exp.val(-2)));
Record r = client.get(policy, keyA);
assertBinEqual(keyA, r, binA, 1);
}
use of org.junit.function.ThrowingRunnable in project aerospike-client-java by aerospike.
the class TestFilterExp method filterARshift.
@Test
public void filterARshift() {
Policy policy = new Policy();
policy.filterExp = Exp.build(Exp.not(Exp.eq(Exp.arshift(Exp.intBin(binE), Exp.val(62)), Exp.val(-1))));
policy.failOnFilteredOut = true;
AerospikeException ae = assertThrows(AerospikeException.class, new ThrowingRunnable() {
public void run() {
client.get(policy, keyB);
}
});
assertEquals(ResultCode.FILTERED_OUT, ae.getResultCode());
policy.filterExp = Exp.build(Exp.eq(Exp.arshift(Exp.intBin(binE), Exp.val(62)), Exp.val(-1)));
Record r = client.get(policy, keyB);
assertBinEqual(keyB, r, binE, -2);
}
use of org.junit.function.ThrowingRunnable in project aerospike-client-java by aerospike.
the class TestFilterExp method filterPow.
@Test
public void filterPow() {
String name = "x";
Policy policy = new Policy();
policy.filterExp = Exp.build(Exp.let(Exp.def(name, Exp.pow(Exp.floatBin(binB), Exp.val(2.0))), Exp.and(Exp.ge(Exp.var(name), Exp.val(4.8399)), Exp.le(Exp.var(name), Exp.val(4.8401)))));
policy.failOnFilteredOut = true;
AerospikeException ae = assertThrows(AerospikeException.class, new ThrowingRunnable() {
public void run() {
client.get(policy, keyA);
}
});
assertEquals(ResultCode.FILTERED_OUT, ae.getResultCode());
Record r = client.get(policy, keyB);
assertBinEqual(keyA, r, binA, 2);
}
use of org.junit.function.ThrowingRunnable in project error-prone by google.
the class FutureReturnValueIgnoredNegativeCases method throwing.
private static void throwing() {
assertThrows(RuntimeException.class, () -> immediateFuture(null));
assertThrows(RuntimeException.class, () -> {
immediateFuture(null);
});
assertThrows(RuntimeException.class, new ThrowingRunnable() {
@Override
public void run() throws Throwable {
immediateFuture(null);
}
});
}
Aggregations