### Question:
SystemService { public byte[] generateInternalCsr(String distinguishedName) throws InvalidDistinguishedNameException { auditDataHelper.put(RestApiAuditProperty.SUBJECT_NAME, distinguishedName); byte[] csrBytes = null; try { KeyPair keyPair = CertUtils.readKeyPairFromPemFile(internalKeyPath); csrBytes = CertUtils.generateCertRequest(keyPair.getPrivate(), keyPair.getPublic(), distinguishedName); } catch (IllegalArgumentException e) { throw new InvalidDistinguishedNameException(e); } catch (IOException | NoSuchAlgorithmException | InvalidKeySpecException | OperatorCreationException e) { throw new DeviationAwareRuntimeException(e); } return csrBytes; } @Autowired  SystemService(GlobalConfService globalConfService, ServerConfService serverConfService,
            AnchorRepository anchorRepository, ConfigurationVerifier configurationVerifier,
            CurrentSecurityServerId currentSecurityServerId,
            AuditDataHelper auditDataHelper); List<TspType> getConfiguredTimestampingServices(); void addConfiguredTimestampingService(TspType tspTypeToAdd); void deleteConfiguredTimestampingService(TspType tspTypeToDelete); byte[] generateInternalCsr(String distinguishedName); AnchorFile getAnchorFile(); AnchorFile getAnchorFileFromBytes(byte[] anchorBytes, boolean shouldVerifyAnchorInstance); void uploadInitialAnchor(byte[] anchorBytes); void replaceAnchor(byte[] anchorBytes); boolean isAnchorImported(); byte[] readAnchorFile(); String getAnchorFilenameForDownload();  }### Answer:
@Test public void generateInternalCsr() throws Exception { byte[] csrBytes = systemService.generateInternalCsr("C=FI, serialNumber=123"); assertTrue(csrBytes.length > 0); }
@Test(expected = InvalidDistinguishedNameException.class) public void generateInternalCsrFail() throws Exception { systemService.generateInternalCsr("this is wrong"); }