diff --git a/utils/src/test/java/org/opentripplanner/utils/color/ColorUtilsTest.java b/utils/src/test/java/org/opentripplanner/utils/color/ColorUtilsTest.java index 7ad2a424fae..c750a834b79 100644 --- a/utils/src/test/java/org/opentripplanner/utils/color/ColorUtilsTest.java +++ b/utils/src/test/java/org/opentripplanner/utils/color/ColorUtilsTest.java @@ -5,26 +5,29 @@ import static org.opentripplanner.utils.color.ColorUtils.computeBrightness; import java.awt.Color; +import java.util.stream.Stream; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; -import org.junit.jupiter.params.provider.FieldSource; +import org.junit.jupiter.params.provider.MethodSource; public class ColorUtilsTest { - static final Arguments[] brightnessExpectations = { - arguments(Color.black, Brightness.DARK), - arguments(Color.green, Brightness.LIGHT), - arguments(Color.blue, Brightness.DARK), - arguments(Color.red, Brightness.LIGHT), - arguments(Color.yellow, Brightness.LIGHT), - arguments(Color.white, Brightness.LIGHT), - arguments(Color.pink, Brightness.LIGHT), - arguments(Color.orange, Brightness.LIGHT), - arguments(Color.cyan, Brightness.LIGHT), - }; + private static Stream brightnessExpectations() { + return Stream.of( + arguments(Color.black, Brightness.DARK), + arguments(Color.green, Brightness.LIGHT), + arguments(Color.blue, Brightness.DARK), + arguments(Color.red, Brightness.LIGHT), + arguments(Color.yellow, Brightness.LIGHT), + arguments(Color.white, Brightness.LIGHT), + arguments(Color.pink, Brightness.LIGHT), + arguments(Color.orange, Brightness.LIGHT), + arguments(Color.cyan, Brightness.LIGHT) + ); + } @ParameterizedTest - @FieldSource("brightnessExpectations") + @MethodSource("brightnessExpectations") void testBrightness(Color color, Brightness brightness) { assertEquals(computeBrightness(color), brightness); }