草庐IT

StudentInfoService

全部标签

java - 我们如何为涉及与数据库连接的方法编写单元测试?

我一直有一个关于为实际与数据库通信并返回一些值的网络方法编写单元测试的查询。例如,我有一个名为“StudentInfoService”的Web服务。该网络服务提供了一个API“getStudentInfo(studentid)”这是一些示例片段publicclassStudentInfoService{publicStudentInfogetStudentInfo(longstudentId){//CommunicateswithDBandcreates//StudentInfoobjectwithnecessaryinformation//andreturnsittothecalle