Testing
本章介绍了 Spring 对集成测试和单元测试的最佳实践的支持。Spring 团队提倡测试驱动开发 (TDD)。Spring 团队发现,正确使用控制反转 (IoC) 确实可以让单元和集成测试更容易(因为类上存在 setter 方法和适当的构造函数,使得它们更容易在测试中连接在一起,而无需建立服务定位器注册表和类似的结构)。
This chapter covers Spring’s support for integration testing and best practices for unit testing. The Spring team advocates test-driven development (TDD). The Spring team has found that the correct use of inversion of control (IoC) certainly does make both unit and integration testing easier (in that the presence of setter methods and appropriate constructors on classes makes them easier to wire together in a test without having to set up service locator registries and similar structures).