Skip to content

Instantly share code, notes, and snippets.

@yusufcakal
Created August 11, 2020 20:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yusufcakal/f3ea4c5a192cfd95f8a504c53606b31e to your computer and use it in GitHub Desktop.
Save yusufcakal/f3ea4c5a192cfd95f8a504c53606b31e to your computer and use it in GitHub Desktop.
Java JUnit5 Parameterized Tests Example
@DisplayName("should convert from page type to notification type")
public class PageTypeNotificationTypeListConverterTest {
@ParameterizedTest
@MethodSource("pageTypeMapped")
public void shouldConvertPageTypeToNotificationType(PageType pageType, List<NotificationType> notificationTypes) {
final PageTypeNotificationTypeListConverter pageTypeNotificationTypeListConverter = new PageTypeNotificationTypeListConverter();
assertEquals(notificationTypes, pageTypeNotificationTypeListConverter.convert(pageType));
}
private static Stream<Arguments> pageTypeMapped() {
return Stream.of(
Arguments.of(PageType.ALL, asList(NotificationType.values())),
Arguments.of(PageType.COMMENT, singletonList(NotificationType.COMMENT)),
Arguments.of(PageType.BID, singletonList(NotificationType.BID)),
Arguments.of(PageType.ORDER, asList(NotificationType.ORDER, NotificationType.SELLER_PENALTY)),
Arguments.of(PageType.CAMPAIGN, asList(NotificationType.REFERRAL, NotificationType.COUPON))
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment