### Question:
DAMFunctions { public static String getTitleOrName(Asset asset) { String title = asset.getMetadataValue(DamConstants.DC_TITLE); return StringUtils.isNotBlank(title) ? title : asset.getName(); } private  DAMFunctions(); static String getTitleOrName(Asset asset);  }### Answer:
@Test public void testGetTitleOrName() { Asset assetWithTitle = mock(Asset.class); String title = RandomStringUtils.randomAlphanumeric(10); when(assetWithTitle.getMetadataValue(DamConstants.DC_TITLE)).thenReturn(title); assertEquals(title, DAMFunctions.getTitleOrName(assetWithTitle)); Asset assetWithoutTitle = mock(Asset.class); String name = RandomStringUtils.randomAlphanumeric(10); when(assetWithoutTitle.getName()).thenReturn(name); assertEquals(name, DAMFunctions.getTitleOrName(assetWithoutTitle)); verify(assetWithTitle, only()).getMetadataValue(DamConstants.DC_TITLE); verify(assetWithoutTitle).getMetadataValue(DamConstants.DC_TITLE); verify(assetWithoutTitle).getName(); verifyNoMoreInteractions(assetWithoutTitle); }