我得到的是生成AES密钥的几种方法。我在做测试用例,但是当我尝试通过测试验证它返回AES密钥的字符串时,它就失败了。
要调用的方法是:
[ #0 - seda://transform-receive] [CLM] [CID=UNKNOWN] o.a.c.impl.ProcessorEndpoint$1.doStart DEBUG Starting producer: Producer[xslt://./xsl/NI/CGL.xsl?contentCache=false&saxon=true]
[ #0 - seda://transform-receive] [CLM] [CID=UNKNOWN] o.a.camel.impl.ProducerCache .doGetProducer DEBUG Adding to producer cache with key: Endpoint[xslt://./xsl/NI/CGL.xsl?contentCache=false&saxon=true] for producer: Producer[xslt://./xsl/NI/CGL.xsl?contentCache=false&saxon=true]
[ #0 - seda://transform-receive] [CLM] [CID=UNKNOWN] o.a.c.b.xml.XsltUriResolver .resolve DEBUG Resolving URI from classpath:: classpath:./xsl/NI/CGL.xsl
[ #0 - seda://transform-receive] [CLM] [CID=UNKNOWN] o.a.c.p.DefaultErrorHandler .log DEBUG Failed delivery for (MessageId: ID-LIBP03P-QK70A9V-60563-1487254928941-1-7 on ExchangeId: ID-LIBP03P-QK70A9V-60563-1487254928941-1-8). On delivery attempt: 0 caught: java.lang.NullPointerException
[ #0 - seda://transform-receive] [CLM] [CID=UNKNOWN] TRANSFORM.COR.XSLT.ROUTE .log ERROR null
[ #0 - seda://transform-receive] [CLM] [CID=UNKNOWN] o.a.c.processor.SendProcessor .process DEBUG >>>> Endpoint[log://showException=true] Exchange[ID-LIBP03P-QK70A9V-60563-1487254928941-1-8]
和测试:( public String getAESString() {
return Base64.encodeToString(this.aesKey.getEncoded(), Base64.DEFAULT);
}
只调用已经测试的生成AES方法)
setupAES
但是我知道,方法getAesString工作正常,因为我正在使用它测试Activity,我可以使用它,没有问题。
如何避免此错误? (我的意思是,我如何通过考试)
我得到的错误日志是:
@Test
public void getAESString() throws NoSuchAlgorithmException {
setupAes();
assertNotNull(cryptoMancer.getAESString());
}
图片,显示了该应用程序中完美运行的方法: