@Test
public void MustInCorrectExecuteActionWhenIOCRegisterThrowException() throws Exception {

    BootstrapItem bootstrapItem = mock(BootstrapItem.class);
    whenNew(BootstrapItem.class).withArguments("CloseAsyncOperationActorPlugin").thenReturn(bootstrapItem);
    when(bootstrapItem.after(anyString())).thenReturn(bootstrapItem);
    when(bootstrapItem.before(anyString())).thenReturn(bootstrapItem);
    plugin.load();
    verifyNew(BootstrapItem.class).withArguments("CloseAsyncOperationActorPlugin");
    ArgumentCaptor<IPoorAction> actionArgumentCaptor = ArgumentCaptor.forClass(IPoorAction.class);
   // verify(bootstrapItem).after("IOC");
    verify(bootstrapItem).process(actionArgumentCaptor.capture());
    verify(bootstrap).add(bootstrapItem);
    IKey createAsyncOpKey = mock(IKey.class);
    when(Keys.getOrAdd(CloseAsyncOperationActor.class.getCanonicalName())).thenReturn(createAsyncOpKey);
    ArgumentCaptor<Function<Object[], Object>> targetFuncArgumentCaptor = ArgumentCaptor.forClass((Class) Function.class);
    doThrow(new RegistrationException("")).when(IOC.class);
    IOC.register(eq(createAsyncOpKey), any());
    whenNew(CreateNewInstanceStrategy.class).withArguments(targetFuncArgumentCaptor.capture())
            .thenReturn(mock(CreateNewInstanceStrategy.class));//the method which was used for constructor is importantly
    try {
        actionArgumentCaptor.getValue().execute();
    } catch (ActionExecuteException e) {
        verifyStatic();
        Keys.getOrAdd(CloseAsyncOperationActor.class.getCanonicalName());
        verifyNew(CreateNewInstanceStrategy.class).withArguments(targetFuncArgumentCaptor.getValue());
        verifyStatic();
        IOC.register(eq(createAsyncOpKey), any(CreateNewInstanceStrategy.class));
        CloseAsyncOperationActor actor = mock(CloseAsyncOperationActor.class);
        IObject actorParams = mock(IObject.class);
        whenNew(CloseAsyncOperationActor.class).withArguments(actorParams).thenReturn(actor);
        assertEquals("Objects must return correct object", targetFuncArgumentCaptor.getValue().apply(new Object[]{actorParams}), actor);
        verifyNew(CloseAsyncOperationActor.class).withArguments(actorParams);
        return;
    }
    assertTrue("Must throw exception", false);
}