@Test public void testActionPerformedThrowsNullPointerException() throws Throwable { try { new Redirect().actionPerformed(new ActionEvent(Long.valueOf(0L), 100, null, 100L, 1000)); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { if (isJavaVersionAtMost(JAVA_14)) { assertNull(ex.getMessage(), "ex.getMessage()"); } else { assertEquals("Cannot invoke \"String.length()\" because \"str\" is null", ex.getMessage(), "ex.getMessage()"); } } }
public void actionPerformed (ActionEvent ev) { StringTokenizer st = new StringTokenizer (ev.getActionCommand ()); ui.reconfigure ( st.nextToken(), st.hasMoreTokens () ? st.nextToken () : null ); }
Redirect implements ActionListener, UIAware { public void actionPerformed (ActionEvent ev) { StringTokenizer st = new StringTokenizer (ev.getActionCommand ()); ui.reconfigure ( st.nextToken(), st.hasMoreTokens () ? st.nextToken () : null ); } }
Redirect implements ActionListener, UIAware { public void actionPerformed (ActionEvent ev) { StringTokenizer st = new StringTokenizer (ev.getActionCommand ()); ui.reconfigure ( st.nextToken(), st.hasMoreTokens () ? st.nextToken () : null ); } Redirect(); }
Redirect implements ActionListener, UIAware { public void actionPerformed (ActionEvent ev) { StringTokenizer st = new StringTokenizer (ev.getActionCommand ()); ui.reconfigure ( st.nextToken(), st.hasMoreTokens () ? st.nextToken () : null ); } Redirect(); void setUI(UI ui, Element e); void actionPerformed(ActionEvent ev); }
Redirect implements ActionListener, UIAware { public void actionPerformed (ActionEvent ev) { StringTokenizer st = new StringTokenizer (ev.getActionCommand ()); ui.reconfigure ( st.nextToken(), st.hasMoreTokens () ? st.nextToken () : null ); } Redirect(); void setUI(UI ui, Element e); void actionPerformed(ActionEvent ev); public UI ui; }