@Test
public void testGenerateIdentityFailure() throws IOException {

    
    InstanceCertManager certManager = Mockito.mock(InstanceCertManager.class);
    Mockito.when(certManager.generateX509Certificate(Mockito.any(), Mockito.any(),
            Mockito.anyInt())).thenReturn(null);
    
    Path path = Paths.get("src/test/resources/valid.csr");
    String csr = new String(Files.readAllBytes(path));
    
    Identity identity = ZTSUtils.generateIdentity(certManager, csr, "unknown.syncer", null, 0);
    assertNull(identity);
}