MapStructAbstractGateway implements Gateway<DE, AP> { @Override public List<DE> getAll() { List<HE> hibernateEntities = dao.findAll(); return hibernateEntitiesToDomainEntitiesConverter.convert(hibernateEntities); } protected  MapStructAbstractGateway(
            Converter<AP, HE> domainAddPayloadToHibernateEntityConverter,
            Merger<DE, HE> domainEntityToHibernateEntityMerger,
            Converter<HE, DE> hibernateEntityToDomainEntityConverter,
            Converter<List<HE>, List<DE>> hibernateEntitiesToDomainEntitiesConverter,
            D dao
    ); DE add(AP payload); @Override List<DE> getAll(); @Override DE findById(String id); @Override DE save(String id, DE entity);  }
@Test public void whenGetAll() { List<TestHibernateEntity> hibernateEntities = mock(List.class); when(dao.findAll()).thenReturn(hibernateEntities); List<TestDomainEntity> domainEntities = mock(List.class); when(hibernateEntitiesToDomainEntitiesConverter.convert(hibernateEntities)).thenReturn(domainEntities); List<TestDomainEntity> actual = gateway.getAll(); verify(dao).findAll(); verifyNoMoreInteractions(dao); assertThat(actual).isSameAs(domainEntities); }