有没有办法从IntelliJ运行/调试配置调用shell脚本?
我一直在询问有关为Web方法编写单元测试的问题,这些方法实际上与数据库通信并返回一些值.
比方说,我有一个名为"StudentInfoService"的Web服务.该网络服务提供API"getStudentInfo(studentid)"
这是一些示例代码段
public class StudentInfoService
{
public StudentInfo getStudentInfo(long studentId) {
//Communicates with DB and creates
// StudentInfo object with necessary information
// and returns it to the caller.
}
}
Run Code Online (Sandbox Code Playgroud)
我们如何为这个方法getStudentInfo实际编写单元测试?一般来说,我们如何为涉及与资源(数据库,文件,JNDI等)连接的方法编写单元测试?