@Test
public void testCounting() {

    FunctionTestHarness harness = FunctionTestHarness.test(ignore -> new FraudCount(), FRAUD_FN, "user1");
    Assert.assertThat(
            "When reporting fraud, the function should not respond",
            harness.invoke(SENDER, ConfirmFraud.getDefaultInstance()),
            sentNothing());
    Assert.assertThat(
            "When querying fraud, the function should return the current count",
            harness.invoke(SENDER, QueryFraud.getDefaultInstance()),
            sent(messagesTo(SENDER, equalTo(ReportedFraud.newBuilder().setCount(1).build()))));
}