### Question:
AtomfeedEventConfigurationServiceImpl implements EventConfigurationService { @Override public String extractUuidFromResourceLinks(Map<String, String> eventResourceLinks, String eventCategory, String preferredClient) { String uuid = extractBasedOnLinkTemplates(eventResourceLinks, eventCategory, preferredClient); if (StringUtils.isBlank(uuid)) { uuid = extractBasedOnResourceLinks(eventResourceLinks, preferredClient); } return uuid; }  @Override EventConfiguration getEventConfigurationByCategory(SyncCategory categoryEnum); @Override String extractUuidFromResourceLinks(Map<String, String> eventResourceLinks, String eventCategory,
			String preferredClient);  }### Answer:
@Test public void extractUuidFromResourceLinks_shouldExtractUuidBasedOnLinkTemplate() { String category = CategoryEnum.PERSON_ADDRESS.getCategory(); Mockito.when(feedConfigurationService.getFeedConfigurationByCategory(category)) .thenReturn(createPersonAddressFeedConfiguration(true)); String uuid = atomFeedEventConfigurationService.extractUuidFromResourceLinks( createResourceLinks(true), category, REST_CLIENT); Assert.assertNotNull(uuid); Assert.assertEquals(ADDRESS_UUID, uuid); }
@Test public void extractUuidFromResourceLinks_shouldExtractUuidBasedOnResourceLink() { String category = CategoryEnum.PERSON_ADDRESS.getCategory(); Mockito.when(feedConfigurationService.getFeedConfigurationByCategory(category)) .thenReturn(createPersonAddressFeedConfiguration(false)); String uuid = atomFeedEventConfigurationService.extractUuidFromResourceLinks( createResourceLinks(false), category, null); Assert.assertNotNull(uuid); Assert.assertEquals(ADDRESS_UUID_FROM_OTHER, uuid); }
@Test public void extractUuidFromResourceLinks_shouldExtractUuidFromPreferredClient() { String category = CategoryEnum.PERSON_ADDRESS.getCategory(); Mockito.when(feedConfigurationService.getFeedConfigurationByCategory(category)) .thenReturn(createPersonAddressFeedConfiguration(true)); String uuid = atomFeedEventConfigurationService.extractUuidFromResourceLinks( createResourceLinks(true), category, OTHER_CLIENT); Assert.assertNotNull(uuid); Assert.assertEquals(ADDRESS_UUID_FROM_OTHER, uuid); }
@Test public void extractUuidFromResourceLinks_shouldExtractUuidFromFirstMatchingIfClientNotExist() { String category = CategoryEnum.PERSON_ADDRESS.getCategory(); Mockito.when(feedConfigurationService.getFeedConfigurationByCategory(category)) .thenReturn(createPersonAddressFeedConfiguration(true)); String uuid = atomFeedEventConfigurationService.extractUuidFromResourceLinks( createResourceLinks(true), category, NOT_EXIST_CLIENT); Assert.assertNotNull(uuid); Assert.assertEquals(ADDRESS_UUID, uuid); }
@Test public void extractUuidFromResourceLinks_shouldExtractUuidFromFirstMatchingIfClientNull() { String category = CategoryEnum.PERSON_ADDRESS.getCategory(); Mockito.when(feedConfigurationService.getFeedConfigurationByCategory(category)) .thenReturn(createPersonAddressFeedConfiguration(true)); String uuid = atomFeedEventConfigurationService.extractUuidFromResourceLinks( createResourceLinks(true), category, null); Assert.assertNotNull(uuid); Assert.assertEquals(ADDRESS_UUID, uuid); }
@Test public void extractUuidFromResourceLinks_shouldExtractUuidWhenMissingUuidPattern() { String category = CategoryEnum.PERSON_ADDRESS.getCategory(); Mockito.when(feedConfigurationService.getFeedConfigurationByCategory(category)) .thenReturn(createPersonAddressFeedConfiguration(true)); String uuid = atomFeedEventConfigurationService.extractUuidFromResourceLinks( createResourceLinks(true), category, CLIENT_WITH_DIFFERENT_PATTERN); Assert.assertNotNull(uuid); Assert.assertEquals(ADDRESS_UUID_FROM_DIFFERENT_CLIENT, uuid); }