Source:
<code>public void runUploadSslCertSelfSignedNoPassword() throws Exception { TransactionLegacy.open("runUploadSslCertSelfSignedNoPassword"); final String certFile = URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed.crt").getFile(),Charset.defaultCharset().name()); final String keyFile = URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed.key").getFile(),Charset.defaultCharset().name()); final String cert = readFileToString(new File(certFile)); final String key = readFileToString(new File(keyFile)); final CertServiceImpl certService = new CertServiceImpl(); certService._accountMgr = Mockito.mock(AccountManager.class); final Account account = new AccountVO("testaccount", 1, "networkdomain", (short)0, UUID.randomUUID().toString()); when(certService._accountMgr.getAccount(anyLong())).thenReturn(account); certService._domainDao = Mockito.mock(DomainDao.class); final DomainVO domain = new DomainVO("networkdomain", 1L, 1L, "networkdomain"); when(certService._domainDao.findByIdIncludingRemoved(anyLong())).thenReturn(domain); certService._sslCertDao = Mockito.mock(SslCertDao.class); when(certService._sslCertDao.persist(any(SslCertVO.class))).thenReturn(new SslCertVO()); certService._accountDao = Mockito.mock(AccountDao.class); when(certService._accountDao.findByIdIncludingRemoved(anyLong())).thenReturn((AccountVO)account); final UploadSslCertCmd uploadCmd = new UploadSslCertCmdExtn(); final Class<?> klazz = uploadCmd.getClass().getSuperclass(); final Field certField = klazz.getDeclaredField("cert"); certField.setAccessible(true); certField.set(uploadCmd, cert); final Field keyField = klazz.getDeclaredField("key"); keyField.setAccessible(true); keyField.set(uploadCmd, key); <START> <END> certService.uploadSslCert(uploadCmd); }</code><technical_language>This method assertions verify correctness of certService.uploadSslCert. Please consider adding assertions</technical_language>

Target:
public void runUploadSslCertSelfSignedNoPassword() throws Exception { TransactionLegacy.open("runUploadSslCertSelfSignedNoPassword"); final String certFile = URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed.crt").getFile(),Charset.defaultCharset().name()); final String keyFile = URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed.key").getFile(),Charset.defaultCharset().name()); final String cert = readFileToString(new File(certFile)); final String key = readFileToString(new File(keyFile)); final CertServiceImpl certService = new CertServiceImpl(); certService._accountMgr = Mockito.mock(AccountManager.class); final Account account = new AccountVO("testaccount", 1, "networkdomain", (short)0, UUID.randomUUID().toString()); when(certService._accountMgr.getAccount(anyLong())).thenReturn(account); certService._domainDao = Mockito.mock(DomainDao.class); final DomainVO domain = new DomainVO("networkdomain", 1L, 1L, "networkdomain"); when(certService._domainDao.findByIdIncludingRemoved(anyLong())).thenReturn(domain); certService._sslCertDao = Mockito.mock(SslCertDao.class); when(certService._sslCertDao.persist(any(SslCertVO.class))).thenReturn(new SslCertVO()); certService._accountDao = Mockito.mock(AccountDao.class); when(certService._accountDao.findByIdIncludingRemoved(anyLong())).thenReturn((AccountVO)account); UploadSslCertCmd uploadCmd = new UploadSslCertCmdExtn(); final Class<?> klazz = uploadCmd.getClass().getSuperclass(); final Field certField = klazz.getDeclaredField("cert"); certField.setAccessible(true); certField.set(uploadCmd, cert); final Field keyField = klazz.getDeclaredField("key"); keyField.setAccessible(true); keyField.set(uploadCmd, key); uploadCmd = Mockito.spy(uploadCmd); certService.uploadSslCert(uploadCmd); Mockito.verify(uploadCmd, Mockito.atLeastOnce()).getAccountName(); Mockito.verify(uploadCmd, Mockito.times(1)).getCert(); }