Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
@ValueSource(strings = {"JANUARY", "FEBRUARY", "MARCH"})
void a_test_with_explicit_conversion(
@ConvertWith(MonthToNumberConverter.class) int month) {
assertTrue(month <= 3);
class MonthToNumberConverter extends SimpleArgumentConverter {
protected Object convert(Object source, Class<?> targetType) {
Month month = Month.valueOf((String) source);
return month.getValue();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment