title: suppress superclass method is not working in PowerMockito
body: <p>I want to suppress <code>Users</code> class <code>insertUser</code> method by <code>PowerMockito.suppress</code> method. But it seems that suppress method is not working well. i.e. it is calling method anyway. <br/>
  I tried to use <code>PowerMockito.doNothing().when(Users.class, "insertUser", users);</code> instead, but I got NullPointerException.<br/></p>
  
  <pre><code>java.lang.NullPointerException
      at org.powermock.api.mockito.internal.expectation.PowerMockitoStubberImpl.addAnswersForStubbing(PowerMockitoStubberImpl.java:67)
      at org.powermock.api.mockito.internal.expectation.PowerMockitoStubberImpl.when(PowerMockitoStubberImpl.java:42)
      at org.powermock.api.mockito.internal.expectation.PowerMockitoStubberImpl.when(PowerMockitoStubberImpl.java:105)
      at test.UsersImplTest.insertUser(UsersImplTest.java:39)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:483)
      at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:68)
  </code></pre>
  
  <p>I know that it is not good idea to call <code>super.insertUser(users);</code>, and I know that it is not good design to call it. But I wonder why <code>suppress</code> method is not working. You can see codes below.</p>
  
  <p>User.class</p>
  
  <pre><code>package test;
  
  public class User {
  
      private int id;
      private String name;
  
      public User() {
      }
  
      public User(String name) {
          this.name = name;
      }
  
      public User(int id, String name) {
          this.id = id;
          this.name = name;
      }
  
      public int getId() {
          return id;
      }
  
      public void setId(int id) {
          this.id = id;
      }
  
      public String getName() {
          return name;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  }
  </code></pre>
  
  <p>Super class</p>
  
  <pre><code>package test;
  
  import java.sql.Connection;
  import java.util.List;
  
  public abstract class Users {
  
      private Connection connection;
  
      public Users(Connection connection) {
          this.connection = connection;
      }
  
      public abstract int getId();
      public abstract User getUser();
      public abstract String getName();
      public abstract void setName(String name);
  
      public Connection getConnection() {
          return connection;
      }
  
      public void insertUser(List&lt;User&gt; users) {
          throw new UnsupportedOperationException();
      }
  }
  </code></pre>
  
  <p>Extending superclass</p>
  
  <pre><code>package test;
  
  import java.sql.Connection;
  import java.util.List;
  
  public class UsersImpl extends Users {
  
      public UsersImpl(Connection connection) {
          super(connection);
      }
  
      @Override
      public int getId() {
          return 0;
      }
  
      @Override
      public User getUser() {
          return null;
      }
  
      @Override
      public String getName() {
          return null;
      }
  
      @Override
      public void setName(String name) {
      }
  
      private void validate(List&lt;User&gt; users) {
          for (User user : users) {
              if (isExists(user)) {
                  users.remove(user);
              }
          }
      }
  
      private boolean isExists(User user) {
          return false;
      }
  
      public void insertUser(List&lt;User&gt; users) {
          validate(users);
          super.insertUser(users);
      }
  }
  </code></pre>
  
  <p>Here I am validating data before insertion. i.e. checking if user already exists. and after that I am inserting user into the database. Here is a test I ran:</p>
  
  <pre><code>package test;
  
  import org.junit.Before;
  import org.junit.Test;
  import org.junit.runner.RunWith;
  import org.powermock.api.mockito.PowerMockito;
  import org.powermock.api.support.membermodification.MemberMatcher;
  import org.powermock.core.classloader.annotations.PrepareForTest;
  import org.powermock.modules.junit4.PowerMockRunner;
  
  import java.sql.Connection;
  import java.util.ArrayList;
  import java.util.List;
  
  @RunWith(PowerMockRunner.class)
  @PrepareForTest({UsersImpl.class, Users.class})
  public class UsersImplTest {
  
      private Connection connection;
      private UsersImpl usersImpl;
      private List&lt;User&gt; users;
  
      @Before
      public void setUp() throws Exception {
  
          connection = PowerMockito.mock(Connection.class);
          PowerMockito.suppress(MemberMatcher.constructor(UsersImpl.class));
          usersImpl = PowerMockito.spy(new UsersImpl(connection));
          users = new ArrayList&lt;&gt;();
          users.add(new User("John"));
          users.add(new User("Smith"));
          users.add(new User("Caro"));
          users.add(new User("Debby"));
      }
  
      @Test
      public void insertUser() throws Exception {
  
          PowerMockito.suppress(MemberMatcher.method(Users.class, "insertUser", List.class));
          PowerMockito.doReturn(true).when(usersImpl, "isExists", new User("Smith"));
  
          usersImpl.insertUser(users);
      }
  }
  </code></pre>