### Question:
CustomUserInfoConverter extends ItemConverter<CustomUserInfoItem, CustomUserInfoValue> { public CustomUserInfoDefinitionItem convert(CustomUserInfoDefinition definition) { CustomUserInfoDefinitionItem item = new CustomUserInfoDefinitionItem(); item.setId(APIID.makeAPIID(definition.getId())); item.setName(definition.getName()); item.setDescription(definition.getDescription()); return item; }  CustomUserInfoDefinitionItem convert(CustomUserInfoDefinition definition); CustomUserInfoItem convert(CustomUserInfo information); @Override CustomUserInfoItem convert(CustomUserInfoValue value);  }### Answer:
@Test public void should_return_a_fully_configured_definition() throws Exception { CustomUserInfoDefinition dummy = new EngineCustomUserInfoDefinition(1L, "foo", "bar"); CustomUserInfoDefinitionItem definition = converter.convert(dummy); assertThat(definition.getAttributes()).containsOnly( entry("id", "1"), entry("name", "foo"), entry("description", "bar")); }
@Test public void should_return_a_fully_configured_custom_information() throws Exception { CustomUserInfoDefinition definition = new EngineCustomUserInfoDefinition(3L); CustomUserInfoValueImpl value = new CustomUserInfoValueImpl(); value.setValue("foo"); CustomUserInfoItem information = converter.convert(new CustomUserInfo(2L, definition, value)); assertThat(information.getAttributes()).containsOnly( entry("userId", "2"), entry("definitionId", "3"), entry("value", "foo")); assertThat(information.getDefinition().getId()).isEqualTo(APIID.makeAPIID(3L)); }
@Test public void should_return_a_fully_configured_custom_information_form_a_value() throws Exception { CustomUserInfoValueImpl value = new CustomUserInfoValueImpl(); value.setUserId(5); value.setDefinitionId(6); value.setValue("foo"); CustomUserInfoItem information = converter.convert(value); assertThat(information.getAttributes()).containsOnly( entry("userId", "5"), entry("definitionId", "6"), entry("value", "foo")); }