### Question:
ProfileEntrySearchDescriptorConverter implements AttributeConverter { @Override public String convert(String attribute) { return MapUtil.getMandatory(mapping, attribute); } ProfileEntrySearchDescriptorConverter(); @Override String convert(String attribute); @Override Map<String, TYPE> getValueTypeMapping();  }### Answer:
@Test public void testWeCanConvertTheProfileEntryId() throws Exception { String descriptor = new ProfileEntrySearchDescriptorConverter() .convert(ProfileEntryItem.ATTRIBUTE_ID); assertEquals(ProfileEntrySearchDescriptor.ID, descriptor); }
@Test public void testWeCanConvertTheProfileEntryIndex() throws Exception { String descriptor = new ProfileEntrySearchDescriptorConverter() .convert(ProfileEntryItem.ATTRIBUTE_INDEX); assertEquals(ProfileEntrySearchDescriptor.INDEX, descriptor); }
@Test public void testWeCanConvertTheProfileEntryName() throws Exception { String descriptor = new ProfileEntrySearchDescriptorConverter() .convert(ProfileEntryItem.ATTRIBUTE_NAME); assertEquals(ProfileEntrySearchDescriptor.NAME, descriptor); }
@Test public void testWeCanConvertTheProfileEntryProfileId() throws Exception { String descriptor = new ProfileEntrySearchDescriptorConverter() .convert(ProfileEntryItem.ATTRIBUTE_PARENT_ID); assertEquals(ProfileEntrySearchDescriptor.PARENT_ID, descriptor); }
@Test public void testWeCanConvertTheProfileEntryParentId() throws Exception { String descriptor = new ProfileEntrySearchDescriptorConverter() .convert(ProfileEntryItem.ATTRIBUTE_PROFILE_ID); assertEquals(ProfileEntrySearchDescriptor.PROFILE_ID, descriptor); }
@Test(expected = RuntimeException.class) public void testTryingToConvertUnexistingDescriptorThrowAnException() { new ProfileSearchDescriptorConverter().convert("someUnsupportedAttribute"); }