Created
August 11, 2020 20:58
-
-
Save yusufcakal/f3ea4c5a192cfd95f8a504c53606b31e to your computer and use it in GitHub Desktop.
Java JUnit5 Parameterized Tests Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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