### Question:
EntitlementUtils { public static Set<String> getDescription(Map<String, Set<String>> data) { Reject.ifNull(data); return data.get(CONFIG_DESCRIPTION); } private  EntitlementUtils(); static ApplicationType createApplicationType(String name, Map<String, Set<String>> data); static Application createApplication(ApplicationType applicationType, String name,
            Map<String, Set<String>> data); static Set<String> getActionSet(Map<String, Boolean> actions); static String getCombiner(Map<String, Set<String>> data); static Set<String> getSubjects(Map<String, Set<String>> data); static Set<String> getConditions(Map<String, Set<String>> data); static Set<String> getResourceTypeUUIDs(Map<String, Set<String>> data); static Set<String> getDescription(Map<String, Set<String>> data); static Set<String> getResources(Map<String, Set<String>> data); static Map<String, Boolean> getActions(final Map<String, Set<String>> data); static Map<String, Boolean> getActions(final Set<String> actionStrings); static String getAttribute(Map<String, Set<String>> data, String attributeName); static String getAttribute(Map<String, Set<String>> data, String attributeName, String defaultValue); static long getDateAttributeAsLong(Map<String, Set<String>> data, String attributeName); static SSOToken getAdminToken(); static SSOToken getSSOToken(Subject subject); static Class<? extends EntitlementCombiner> getEntitlementCombiner(String name); static ResourceType resourceTypeFromMap(String uuid, Map<String, Set<String>> data); static final String SERVICE_NAME; static final String INDEXES_NAME; static final String REALM_DN_TEMPLATE; static final String CONFIG_ACTIONS; static final String CONFIG_DESCRIPTION; static final String CONFIG_RESOURCES; static final String CONFIG_CREATED_BY; static final String CONFIG_CREATION_DATE; static final String CONFIG_LAST_MODIFIED_BY; static final String CONFIG_LAST_MODIFIED_DATE; static final String CONFIG_NAME; static final String CONFIG_APPLICATION_TYPE; static final String EMPTY; static final String SCHEMA_RESOURCE_TYPES; static final String CONFIG_RESOURCE_TYPES; static final String CONFIG_PATTERNS; static final String RESOURCE_TYPE; static final String REGISTERED_APPLICATIONS; static final String APPLICATION_TYPE; static final String APPLICATION_TYPES; static final String CONFIG_RESOURCE_TYPE_UUIDS; static final String APPLICATION; }### Answer:
@Test public void shouldRetrieveDescriptionFromDataWhenItIsPresent() { String expectedDescription = "A description"; Map<String,Set<String>> data = new HashMap<String, Set<String>>(); data.put("attributeName", new HashSet<String>(Arrays.asList(new String[]{"Attribute value 1", "Attribute value 2"}))); data.put("description", new HashSet<String>(Arrays.asList(new String[]{expectedDescription}))); data.put("anotherAttributeName", new HashSet<String>(Arrays.asList(new String[]{"Another attribute value"}))); Set<String> actualDescription = EntitlementUtils.getDescription(data); assertEquals(actualDescription.size(), 1, "Actual description expected to only contain one item."); assertEquals(actualDescription.iterator().next(), expectedDescription, "Actual description found was not as expected."); }
@Test public void shouldNotRetrieveDescriptionFromDataWhenItIsNotPresent() { Map<String,Set<String>> data = new HashMap<String, Set<String>>(); data.put("attributeName", new HashSet<String>(Arrays.asList(new String[]{"Attribute value 1", "Attribute value 2"}))); data.put("anotherAttributeName", new HashSet<String>(Arrays.asList(new String[]{"Another attribute value"}))); Set<String> actualDescription = EntitlementUtils.getDescription(data); assertEquals(actualDescription, null, "Actual description expected to be null."); }