Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You CAN in fact monkeypatch getDate - look at a Mockito add-on known as PowerMockito! While it's impossible to mock it out in the normal JVM "happy path," the JVM is powerful enough to let you mess with classloading and edit the bytecode at load-time to mock out even system classes.

(Disclaimer: have not used PowerMockito in ages, am not confident it works with the new module system.)



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: