@Test
@SuppressWarnings("unchecked")
public void getDisplayName() throws Exception {

    // Mock property node
    final Property displayName = Mockito.when(Mockito.mock(Property.class).getString()).thenReturn("Test Node").getMock();
    final Node node = Mockito.mock(Node.class);
    Mockito.when(node.getProperty(JcrExtensibleType.NAME))
        .thenReturn(displayName)
        .thenThrow(PathNotFoundException.class);
    // Test display name
    final JcrUserFieldDescriptor userField = new JcrUserFieldDescriptor(node, Mockito.mock(PropertyDefinition.class));
    Assert.assertEquals("Test Node", userField.getDisplayName());
    Assert.assertNull(userField.getDisplayName());
}