I claim that my testing is failing because my tested class isn't seeing mocks. My evidence:
- In the debugger my objects have ordinary java.sql.* parents. They aren't of Mockito.*. 
- When I try stepping into objects like DbSql I see actual DbSql code, not Mockito code. 
- When I run, my executeQuery() throws a NullPointerException. 
Here are parts of my test class:
//  Test Class
//  My mocks:
HostMessage mockHostMessage;
DbConnect mockDbConnect;
DbCache mockDbCache;
DbSql mockDbSql;
ResultSet mockResultSet;
@BeforeEach
void setUp()
{
  mockHostMessage     = Mockito.mock(HostMessage.class);
  mockDbConnect       = Mockito.mock(DbConnect.class);
  mockDbCache         = Mockito.mock(DbCache.class);
  mockDbSql           = Mockito.mock(DbSql.class);
  mockResultSet       = Mockito.mock(ResultSet.class);
}
@Test
void myTest() {
  String errMsg = "something";
  try {
    doReturn(mockDbSql).when(mockDbCache).getDbSql(any(), anyString());
    doReturn(mockResultSet).when(mockDbSql).executeQuery();
    doReturn(false).when(mockResultSet).next();
    (new CartonRoutingProcessor()).process(mockDbConnect, mockHostMessage);
  } catch(Throwable t) {
    
    if(t instanceof MockitoException) {
      fail(t.getMessage());
    } else if(t instanceof SqlException) {
      Assertions.assertTrue(t.getMessage().contains(errMsg),
           "Phrase not found in SqlException message: " + errMsg);
      fail(t.getMessage());
    } else {
      fail(t.getMessage());
    }
    
  }
Here are parts of my CartonRoutingProcessor business logic:
public boolean process(DbConnect conn, HostMessage msg) throws SQLException
{
  try(DbCache dbc = new DbCache())
  {
    DbSql mySql = dbc.getDbSql(conn, String.format("select id from routes"));
    
    // Throws NullPointerException right here, 
    // while trying to execute the query rather than mock it.
    ResultSet rs = mySql.executeQuery();
    String routeType = rs.next() ? rs.getString("id") : null;
    ...
  }
  ...
}
The Mockito manual, and lots of web pages, tell how to do this task.
Yet I'm not getting the results I'm told I should have.
Can a kind developer give me a clue?
 
    