MiddlewareSet implements Middleware { public CompletableFuture<Void> receiveActivityWithStatus( TurnContext context, BotCallbackHandler callback ) { return receiveActivityInternal(context, callback); }  MiddlewareSet use(Middleware middleware); @Override CompletableFuture<Void> onTurn(TurnContext turnContext, NextDelegate next); CompletableFuture<Void> receiveActivityWithStatus(
        TurnContext context,
        BotCallbackHandler callback
    );  }
@Test public void NoMiddleware() { try { MiddlewareSet m = new MiddlewareSet(); m.receiveActivityWithStatus(null, null).join(); Assert.assertTrue(true); } catch (Throwable t) { Assert.fail("No exception expected" + t.getMessage()); } }
@Test public void NoMiddlewareWithDelegate() { MiddlewareSet m = new MiddlewareSet(); wasCalled = false; BotCallbackHandler cb = (ctx) -> { wasCalled = true; return CompletableFuture.completedFuture(null); }; m.receiveActivityWithStatus(null, cb).join(); Assert.assertTrue("Delegate was not called", wasCalled); }
@Test public void Status_RunAtEndEmptyPipeline() { MiddlewareSet m = new MiddlewareSet(); final boolean[] didAllRun = { false }; BotCallbackHandler cb = (context) -> { didAllRun[0] = true; return CompletableFuture.completedFuture(null); }; m.receiveActivityWithStatus(null, cb); Assert.assertTrue(didAllRun[0]); }