@Test public void testActionPerformedThrowsNullPointerException() throws Throwable { try { new BSHAction().actionPerformed(null); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { if (isJavaVersionAtMost(JAVA_14)) { assertNull(ex.getMessage(), "ex.getMessage()"); } else { assertEquals("Cannot invoke \"java.awt.event.ActionEvent.getActionCommand()\" because \"ev\" is null", ex.getMessage(), "ex.getMessage()"); } } }
public void actionPerformed (ActionEvent ev) { String bshSource = ev.getActionCommand(); try { Interpreter bsh = new Interpreter (); bsh.source (bshSource); } catch (Exception e) { e.printStackTrace(); } }
BSHAction implements ActionListener, UIAware { public void actionPerformed (ActionEvent ev) { String bshSource = ev.getActionCommand(); try { Interpreter bsh = new Interpreter (); bsh.source (bshSource); } catch (Exception e) { e.printStackTrace(); } } }
BSHAction implements ActionListener, UIAware { public void actionPerformed (ActionEvent ev) { String bshSource = ev.getActionCommand(); try { Interpreter bsh = new Interpreter (); bsh.source (bshSource); } catch (Exception e) { e.printStackTrace(); } } BSHAction(); }
BSHAction implements ActionListener, UIAware { public void actionPerformed (ActionEvent ev) { String bshSource = ev.getActionCommand(); try { Interpreter bsh = new Interpreter (); bsh.source (bshSource); } catch (Exception e) { e.printStackTrace(); } } BSHAction(); void setUI(UI ui, Element e); void actionPerformed(ActionEvent ev); }
BSHAction implements ActionListener, UIAware { public void actionPerformed (ActionEvent ev) { String bshSource = ev.getActionCommand(); try { Interpreter bsh = new Interpreter (); bsh.source (bshSource); } catch (Exception e) { e.printStackTrace(); } } BSHAction(); void setUI(UI ui, Element e); void actionPerformed(ActionEvent ev); public UI ui; }