title: How to mock Abstract Class?
body: <p>I'm mocking Abstract class but it gives an error that I can't instantiate the abstract class. I guess I'm missing some basics of mocking. So why can't I mock abstract class?  </p>
  
  <pre><code>@Repository
      public abstract class AbstractAccountDaoImpl implements AccountDao{
  
          @Autowired
          SimpleJdbcCall simpleJdbcCall;
  
          @Override
          public List&lt;Account&gt; getAccounts(String id){
              SimpleJdbcCall simpleJdbcCall = getNewSimpleJdbcCall()
                      .withProcedureName(getAccountsProc)
                      .declareParameters(new SqlParameter("account_id", Types.VARCHAR));
  
                  Object[] params = new Object[]  {id};
                  simpleJdbcCall.returningResultSet("result", new AccountRowMapper());
  
                  Map&lt;String, Object&gt; map = simpleJdbcCall.execute(params);
  
                  return (List&lt;Account&gt;) map.get("result");
  
          }
  </code></pre>
  
  <p>Below is my JUnit:</p>
  
  <pre><code>public class AbstractAccountDaoImplTest  {
  
         private String IDS = "IDS";
  
      @InjectMocks
      private AbstractAccountDaoImpl abstractAccountDaoImpl;
  
      @Before
      public void setUp() {
          MockitoAnnotations.initMocks(this);
      }
  
      @Test
      public void shouldReturnAccounts() {
          Map&lt;String, Object&gt; map = new HashMap&lt;&gt;();
  
          map.put("result", Arrays.asList(new Account(), new Account()));
  
          simpleJdbcCallDefaultMock(simpleJdbcCallProvider, map);
  
          List&lt;Account&gt; resultList = abstractAccountDaoImpl.getAccounts(IDS);
          assertEquals(2, resultList.size());
      }
  
       public static void simpleJdbcCallDefaultMock(SimpleJdbcCallProvider simpleJdbcCallProvider, Map&lt;String, Object&gt; map) {
          SimpleJdbcCall simpleJdbcCall = Mockito.mock(SimpleJdbcCall.class);
  
          when(simpleJdbcCallProvider.getNewSimpleJdbcCall()).thenReturn(simpleJdbcCall);
  
          }
  </code></pre>
  
  <p>How can I mock this using Mockito? Or do I need to use something else to mock this? 
  If I mock from mockito, it gives me an error cannot instantiate <code>AbstractAccountDaoImpl</code>.</p>
  
  <p>Any advice?</p>