Mocking Java SE 6 API in JavaScript