If you're a seasoned unit tester, you've learned to take note when you see any code working with time,*concurrency*, random, persistence and disc I/O. The reason for this is that tests can be very brittle and sometimes down-right impossible to test properly. This post will show how to abstract out "time" by injecting a replacement for it in the consumer. This post will be using Spring 3 as the Dependency Injection container, though Guice, other DI containers or constructor/setters on POJOs would work......
如果你每日只在遗留代码中挣扎,或许是时候抬起头,看看老Java中的新东西。 Guava 一句话,只要你做Java项目,就应该用Guava。 guava是Google出品的一套Java核心库,在我看来,它甚至应该是JDK的一部分。作为一个Java程序员,如果你没抱......