@Test
public void testShouldPersistKDWhenKDFoundInRequest() throws Exception {

  // GIVEN
  Capture<KerberosDescriptorEntity> kdEntityCaptor = EasyMock.newCapture();
  kerberosDescriptorDAO.create(capture(kdEntityCaptor));
  EasyMock.replay(kerberosDescriptorDAO);
  Map<String, Object> reuqestMap = new HashMap<>();
  Map<String, Object> security = new HashMap<>();
  security.put(SecurityConfigurationFactory.TYPE_PROPERTY_ID, SecurityType.KERBEROS.toString());
  security.put(SecurityConfigurationFactory.KERBEROS_DESCRIPTOR_PROPERTY_ID, testKDReqPropertyMap());
  reuqestMap.put(SecurityConfigurationFactory.SECURITY_PROPERTY_ID, security);
  // WHEN
  testSubject.createSecurityConfigurationFromRequest(reuqestMap, true);
  // THEN
  EasyMock.verify(kerberosDescriptorDAO);
  Assert.assertEquals("The persisted descriptortext is not as expected",
      "{\"test\":\"{\\\"test\\\":\\\"test json\\\"}\"}",
      kdEntityCaptor.getValue().getKerberosDescriptorText());
  Assert.assertNotNull("There is no generated kerberos descriptor reference in the persisting entity!",
      kdEntityCaptor.getValue().getName());
}