### Question:
Dispose implements ActionListener, UIAware { public void actionPerformed (ActionEvent ev) { ui.dispose (); } Dispose(); void setUI(UI ui, Element e); void actionPerformed(ActionEvent ev); public UI ui; }### Answer:
@Test public void testActionPerformedThrowsNullPointerException() throws Throwable { Dispose dispose = new Dispose(); try { dispose.actionPerformed(new ActionEvent(Integer.valueOf(0), 100, "testDisposeParam3", 100L, 1000)); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { if (isJavaVersionAtMost(JAVA_14)) { assertNull(ex.getMessage(), "ex.getMessage()"); } else { assertEquals("Cannot invoke \"org.jpos.ui.UI.dispose()\" because \"this.ui\" is null", ex.getMessage(), "ex.getMessage()"); } assertNull(dispose.ui, "dispose.ui"); } }