如何编写kotlin单位测试以测试一个函数在内部调用其他功能
我是新的Kotlin,在编写Kotlin Junit测试时面临问题,如果条件无法进入!
override fun process(message: String) {
try {
logger.info("(invFileTransformer) Process inventory processor evaluation started...")
val sqsPayloadInfo = UtilityFunctions.sqsQPayloadExtractor(message)
val inventoryInfo = UtilityFunctions.extractInventoryType(sqsPayloadInfo[0])
if (!inventoryInfo.isNullOrEmpty()) {
transformerProcessService.startProcess(
sqsPayloadInfo[0],
inventoryInfo[0],
inventoryInfo[1],
sqsPayloadInfo[1]
)
} else {
logger.info("(invFileTransformer) Incorrect inventory directory path!")
}
} catch (ex: Exception) {
ex.message
logger.info("(invFileTransformer) Process inventory processor evaluation error: $ex.message")
}
}
请帮助或分享有用的链接,谢谢。
I'm new Kotlin and facing issue while writing Kotlin Junit test, unable to go inside if condition!
override fun process(message: String) {
try {
logger.info("(invFileTransformer) Process inventory processor evaluation started...")
val sqsPayloadInfo = UtilityFunctions.sqsQPayloadExtractor(message)
val inventoryInfo = UtilityFunctions.extractInventoryType(sqsPayloadInfo[0])
if (!inventoryInfo.isNullOrEmpty()) {
transformerProcessService.startProcess(
sqsPayloadInfo[0],
inventoryInfo[0],
inventoryInfo[1],
sqsPayloadInfo[1]
)
} else {
logger.info("(invFileTransformer) Incorrect inventory directory path!")
}
} catch (ex: Exception) {
ex.message
logger.info("(invFileTransformer) Process inventory processor evaluation error: $ex.message")
}
}
Please help or share a helpful link, Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论