mock a resultset code example Example: mockito mock resultset Mockito.when(resultSetMock.next()).thenReturn(true).thenReturn(false);