Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

A method that returns a stream of JUnit Arguments

// A method that returns a stream of JUnit Arguments
private static Stream<Arguments> dataForTestSearchString() {
   return Stream.of(//
         Arguments.of("Any string matches any string.", "(.*)", "xyz", "xyz") //
         , Arguments.of("Pick year digits out of a date.", "[0-9]{2}/[0-9]{2}/([0-9]{4})", "31/12/2032", "2032") //
         , Arguments.of("No digits found.", "[0-9]+", "not a digit", null) //
         , Arguments.of("First two words.", "(?<firstTwoWords>w+ w+) .*", "abc xyz one two", "abc xyz") //
         , Arguments.of("Bad regex.", "([0-9+)", "123", "PatternSyntaxException: (?s)Unclosed character class.*") //
   );
}
Source by robertmarkbramprogrammer.blogspot.com #
 
PREVIOUS NEXT
Tagged: #A #method #returns #stream #JUnit #Arguments
ADD COMMENT
Topic
Name
6+7 =