### Question:
APICustomUserInfoDefinition extends ConsoleAPI<CustomUserInfoDefinitionItem> implements
        APIHasAdd<CustomUserInfoDefinitionItem>,
        APIHasSearch<CustomUserInfoDefinitionItem>,
        APIHasDelete { public CustomUserInfoDefinitionItem add(CustomUserInfoDefinitionItem definition) { return converter.convert(engineClientCreator.create(getEngineSession()) .createDefinition(new CustomUserInfoDefinitionCreator( definition.getName(), definition.getDescription()))); } APICustomUserInfoDefinition(CustomUserInfoEngineClientCreator engineClientCreator); CustomUserInfoDefinitionItem add(CustomUserInfoDefinitionItem definition); void delete(final List<APIID> ids); ItemSearchResult<CustomUserInfoDefinitionItem> search(
            final int page,
            final int resultsByPage,
            final String search,
            final String orders,
            final Map<String, String> filters); String defineDefaultSearchOrder(); static final String FIX_ORDER; }### Answer:
@Test public void add_should_return_the_added_item() throws Exception { given(engine.createDefinition(any(CustomUserInfoDefinitionCreator.class))) .willReturn(new EngineCustomUserInfoDefinition(2L)); CustomUserInfoDefinitionItem added = api.add(new CustomUserInfoDefinitionItem()); assertThat(added.getId()).isEqualTo(APIID.makeAPIID(2L)); }
@Test public void add_should_create_an_item_based_on_item_passed_in_parameter() throws Exception { given(engine.createDefinition(any(CustomUserInfoDefinitionCreator.class))) .willReturn(new EngineCustomUserInfoDefinition(1L)); ArgumentCaptor<CustomUserInfoDefinitionCreator> argument = ArgumentCaptor.forClass(CustomUserInfoDefinitionCreator.class); CustomUserInfoDefinitionItem item = new CustomUserInfoDefinitionItem(); item.setName("foo"); item.setDescription("bar"); api.add(item); verify(engine).createDefinition(argument.capture()); assertThat(argument.getValue().getName()).isEqualTo("foo"); assertThat(argument.getValue().getDescription()).isEqualTo("bar"); }