@SuppressWarnings("unchecked")
@Test
public void testBeforeExtract() throws Exception {

    final PackageId arg0 = PackageId.fromString("my_packages:example:1.0");
    final Session arg1 = mock(Session.class);
    final PackageProperties arg2 = mock(PackageProperties.class);
    final MetaInf arg3 = mock(MetaInf.class);
    final List<PackageId> arg4 = new ArrayList<>();
    final CompletableFuture<PackageId> slot0 = new CompletableFuture<>();
    final CompletableFuture<Session> slot1 = new CompletableFuture<>();
    final CompletableFuture<PackageProperties> slot2 = new CompletableFuture<>();
    final CompletableFuture<MetaInf> slot3 = new CompletableFuture<>();
    final CompletableFuture<List> slot4 = new CompletableFuture<>();
    final ProgressCheck delegate = mock(ProgressCheck.class);
    doAnswer(call -> {
        slot0.complete(call.getArgument(0, PackageId.class));
        slot1.complete(call.getArgument(1, Session.class));
        slot2.complete(call.getArgument(2, PackageProperties.class));
        slot3.complete(call.getArgument(3, MetaInf.class));
        slot4.complete(call.getArgument(4, List.class));
        return true;
    }).when(delegate).beforeExtract(
            any(PackageId.class),
            any(Session.class),
            any(PackageProperties.class),
            any(MetaInf.class),
            any(List.class));
    final SilencingCheckFacade alias = new SilencingCheckFacade(delegate);
    alias.setSilenced(true);
    alias.beforeExtract(arg0, arg1, arg2, arg3, arg4);
    assertFalse("arg0 should not be done", slot0.isDone());
    assertFalse("arg1 should not be done", slot1.isDone());
    assertFalse("arg2 should not be done", slot2.isDone());
    assertFalse("arg3 should not be done", slot3.isDone());
    assertFalse("arg4 should not be done", slot4.isDone());
    alias.setSilenced(false);
    alias.beforeExtract(arg0, arg1, arg2, arg3, arg4);
    assertSame("same arg0", arg0, slot0.getNow(null));
    assertSame("same arg1", arg1, slot1.getNow(null));
    assertSame("same arg2", arg2, slot2.getNow(null));
    assertSame("same arg3", arg3, slot3.getNow(null));
    assertSame("same arg4", arg4, slot4.getNow(null));
}