@Test
/**
 * @see https://github.com/caeos/coner-core/issues/157
 */
public void testIssue157() throws EntityNotFoundException, AddEntityException {

    HandicapGroupSetAddPayload payload = mock(HandicapGroupSetAddPayload.class);
    HandicapGroup domainEntity = DomainEntityTestUtils.fullHandicapGroup();
    when(payload.getHandicapGroupIds()).thenReturn(Sets.newHashSet(domainEntity.getId()));
    when(handicapGroupEntityService.getById(domainEntity.getId())).thenReturn(domainEntity);
    HandicapGroupSet domainSetEntity = mock(HandicapGroupSet.class);
    when(gateway.add(payload)).thenReturn(domainSetEntity);
    HandicapGroupSet actual = service.add(payload);
    verify(payload).setHandicapGroups(
            argThat(argument -> argument.contains(domainEntity))
    );
    verify(gateway).add(payload);
    assertThat(actual).isSameAs(domainSetEntity);
}