@Test
public void testShoudCreateResourceWhenNameAndDescriptorProvided() throws Exception {

  // GIVEN
  kerberosDescriptorResourceProvider = new KerberosDescriptorResourceProvider(kerberosDescriptorDAO,
      kerberosDescriptorFactory, Collections.<String>emptySet(), Collections.<Resource.Type, String>emptyMap(), null);
  EasyMock.expect(request.getProperties())
      .andReturn(requestPropertySet(KERBEROS_DESCRIPTORS_KERBEROS_DESCRIPTOR_NAME, TEST_KERBEROS_DESCRIPTOR_NAME))
      .times(3);
  EasyMock.expect(request.getRequestInfoProperties())
      .andReturn(requestInfoPropertyMap(Request.REQUEST_INFO_BODY_PROPERTY, TEST_KERBEROS_DESCRIPTOR))
      .times(3);
  EasyMock.expect(kerberosDescriptorFactory.createKerberosDescriptor(anyString(), anyString()))
      .andReturn(new KerberosDescriptorImpl(TEST_KERBEROS_DESCRIPTOR_NAME, TEST_KERBEROS_DESCRIPTOR));
  Capture<KerberosDescriptorEntity> entityCapture = EasyMock.newCapture();
  kerberosDescriptorDAO.create(capture(entityCapture));
  EasyMock.replay(request, kerberosDescriptorFactory, kerberosDescriptorDAO);
  // WHEN
  kerberosDescriptorResourceProvider.createResources(request);
  // THEN
  Assert.assertNotNull(entityCapture.getValue());
  Assert.assertEquals("The resource name is invalid!", TEST_KERBEROS_DESCRIPTOR_NAME, entityCapture.getValue()
      .getName());
}