@Test
public void MustInCorrectExecuteActionWhenIOCRegisterThrowException () throws Exception {

    BootstrapItem item = mock(BootstrapItem.class);
    whenNew(BootstrapItem.class).withArguments("IFieldNamePlugin").thenReturn(item);
    when(item.after(anyString())).thenReturn(item);
    plugin.load();
    verifyNew(BootstrapItem.class).withArguments("IFieldNamePlugin");
    verify(item).after("IOC");
    ArgumentCaptor<IPoorAction> iPoorActionArgumentCaptor = ArgumentCaptor.forClass(IPoorAction.class);
    verify(item).process(iPoorActionArgumentCaptor.capture());
    verify(bootstrap).add(item);
    IKey iFieldNameKey = mock(IKey.class);
    when(Keys.getOrAdd("info.smart_tools.smartactors.iobject.ifield_name.IFieldName")).thenReturn(iFieldNameKey);
    ArgumentCaptor<ResolveByNameIocStrategy> resolveByNameIocStrategyArgumentCaptor =
            ArgumentCaptor.forClass(ResolveByNameIocStrategy.class);
    doThrow(new RegistrationException("")).when(IOC.class);
    IOC.register(eq(iFieldNameKey), any());
    try {
        iPoorActionArgumentCaptor.getValue().execute();
    } catch (ActionExecuteException e) {
        verifyStatic();
        Keys.getOrAdd("info.smart_tools.smartactors.iobject.ifield_name.IFieldName");
        verifyStatic();
        IOC.register(eq(iFieldNameKey), resolveByNameIocStrategyArgumentCaptor.capture());
        String exampleFieldName = "exampleField";
        FieldName newFieldName = mock(FieldName.class);
        whenNew(FieldName.class).withArguments(exampleFieldName).thenReturn(newFieldName);
        assertTrue("Must return correct value",
                resolveByNameIocStrategyArgumentCaptor.getValue().resolve(exampleFieldName) == newFieldName);
        verifyNew(FieldName.class).withArguments(exampleFieldName);
        return;
    }
    assertTrue("Must throw exception", false);
}