@Test public void whenAddNullPayload() throws Exception { try { gateway.add(null); failBecauseExceptionWasNotThrown(NullPointerException.class); } catch (NullPointerException npe) { verifyZeroInteractions(dao); } }
public DE add(AP payload) { Preconditions.checkNotNull(payload); HE hibernateEntity = domainAddPayloadToHibernateEntityConverter.convert(payload); dao.create(hibernateEntity); return hibernateEntityToDomainEntityConverter.convert(hibernateEntity); }
MapStructAbstractGateway implements Gateway<DE, AP> { public DE add(AP payload) { Preconditions.checkNotNull(payload); HE hibernateEntity = domainAddPayloadToHibernateEntityConverter.convert(payload); dao.create(hibernateEntity); return hibernateEntityToDomainEntityConverter.convert(hibernateEntity); } }
MapStructAbstractGateway implements Gateway<DE, AP> { public DE add(AP payload) { Preconditions.checkNotNull(payload); HE hibernateEntity = domainAddPayloadToHibernateEntityConverter.convert(payload); dao.create(hibernateEntity); return hibernateEntityToDomainEntityConverter.convert(hibernateEntity); } protected  MapStructAbstractGateway(
            Converter<AP, HE> domainAddPayloadToHibernateEntityConverter,
            Merger<DE, HE> domainEntityToHibernateEntityMerger,
            Converter<HE, DE> hibernateEntityToDomainEntityConverter,
            Converter<List<HE>, List<DE>> hibernateEntitiesToDomainEntitiesConverter,
            D dao
    ); }
MapStructAbstractGateway implements Gateway<DE, AP> { public DE add(AP payload) { Preconditions.checkNotNull(payload); HE hibernateEntity = domainAddPayloadToHibernateEntityConverter.convert(payload); dao.create(hibernateEntity); return hibernateEntityToDomainEntityConverter.convert(hibernateEntity); } 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); }
MapStructAbstractGateway implements Gateway<DE, AP> { public DE add(AP payload) { Preconditions.checkNotNull(payload); HE hibernateEntity = domainAddPayloadToHibernateEntityConverter.convert(payload); dao.create(hibernateEntity); return hibernateEntityToDomainEntityConverter.convert(hibernateEntity); } 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);  }