@Before public void setUpTestData() { persistedDto = ChannelDTO.builder().id(CHANNEL_ID).name(CHANNEL_NAME).build(); emptyPostedDto = ChannelDTO.builder().name(StringUtils.EMPTY).build(); correctPostedDto = ChannelDTO.builder().name(CHANNEL_NAME).build(); }
@Before public void init() { this.channelService = new ChannelServiceImpl(channelRepository, converterService); facebookDto = ChannelDTO.builder() .id(CHANNEL_ID_FACEBOOK) .name(CHANNEL_NAME_FACEBOOK) .deleted(false) .build(); facebookEntity = ChannelEntity.builder() .id(CHANNEL_ID_FACEBOOK) .name(CHANNEL_NAME_FACEBOOK) .deleted(false) .build(); deletedFacebookDto = ChannelDTO.builder() .id(CHANNEL_ID_FACEBOOK) .name(CHANNEL_NAME_FACEBOOK) .deleted(true) .build(); deletedFacebookEntity = ChannelEntity.builder() .id(CHANNEL_ID_FACEBOOK) .name(CHANNEL_NAME_FACEBOOK) .deleted(true) .build(); dtkDto = ChannelDTO.builder().id(CHANNEL_ID_DTK).name(CHANNEL_NAME_DTK).deleted(false).build(); dtkEntity = ChannelEntity.builder().id(CHANNEL_ID_DTK).name(CHANNEL_NAME_DTK).deleted(false).build(); linkedinDto = ChannelDTO.builder() .id(CHANNEL_ID_LINKEDIN) .name(CHANNEL_NAME_LINKEDIN) .deleted(false) .build(); linkedinEntity = ChannelEntity.builder() .id(CHANNEL_ID_LINKEDIN) .name(CHANNEL_NAME_LINKEDIN) .deleted(false) .build(); expectedChannelDTOList = Arrays.asList(facebookDto, dtkDto, linkedinDto); expectedChannelEntityList = Arrays.asList(facebookEntity, dtkEntity, linkedinEntity); }
@Test(expected = IllegalArgumentException.class) public void saveOrUpdateShouldThrowIllegalArgumentExceptionWhenChannelNameIsNull() { // Given ChannelDTO channelDTO = ChannelDTO.builder().name(null).build(); // When this.channelService.saveOrUpdate(channelDTO); // Then }