Skip to main content

Welcome to Geoff Hayward's Weblog

Commenting on Java, JavaFX, Java EE, Joomla, and IoT.

Java singleton's are hard to unit test because the state of the singleton is altered as each test runs. But for testing sake you can reset the singleton's state use reflection. Here is an example that worked for me.

public void setup() throws NoSuchFieldException, IllegalAccessException {
        Field instance = RemoteMessageTranslation.class.getDeclaredField("set");
        instance.setBoolean(null, false);

I hope this helps


Mailing List

Responsive Media

With the ResponsiveMedia plugin for Joomla it is easy to add 3rd party content from YouTube, Vimeo, and Instagram right in to any Joomla! article.