Java 类org.junit.jupiter.params.provider.Arguments 实例源码

项目:HotaruFX    文件:NodePropertiesTypeTest.java   
static Stream<Arguments> nodeProvider() {
    return Stream.of(
            new ArcNode(),
            new CircleNode(),
            new EllipseNode(),
            new GroupNode(Collections.singletonList(new TextNode())),
            new LineNode(),
            new PolygonNode(Arrays.asList(0d, 0d, 20d, 20d, 30d, 30d)),
            new PolylineNode(Arrays.asList(0d, 0d, 20d, 20d, 30d, 30d, 0d, 0d)),
            new RectangleNode(),
            new SVGPathNode(),
            new TextNode()
    ).flatMap(node -> node.propertyBindings()
                    .entrySet()
                    .stream()
                    .map(entry -> Arguments.of(
                            node,
                            entry.getKey(),
                            entry.getValue(),
                            node.getClass().getSimpleName()
                    ))
            );
}
项目:autotest    文件:AutoTestExtension.java   
@Override
public Stream<TestTemplateInvocationContext> provideTestTemplateInvocationContexts(ExtensionContext context) {
    Method templateMethod = Preconditions.notNull(context.getTestMethod().orElse(null),
            "test method must not be null");
    AutoTestNameFormatter formatter = createNameFormatter(templateMethod);
    AtomicLong invocationCount = new AtomicLong(0L);
    return (Stream) findRepeatableAnnotations(templateMethod, ArgumentsSource.class)
            .stream()
            .map(ArgumentsSource::value)
            .map(ReflectionUtils::newInstance)
            .map(provider -> AnnotationConsumerInitializer.initialize(templateMethod, provider))
            .flatMap(provider -> arguments(provider, context))
            .map(Arguments::get)
            .map((arguments) -> {
                return new AutoTestInvocationContext(formatter, arguments);
            })
            .peek((invocationContext) -> {
                invocationCount.incrementAndGet();
            }).onClose(() -> {
                Preconditions.condition(invocationCount.get() > 0L, () -> {
                    return "当使用注解 @" + AutoTest.class.getSimpleName() + " 的时候,测试方法需要至少一个参数";
                });
            });

}
项目:incubator-plc4x    文件:Plc4XS7ProtocolTest.java   
private static Stream<Arguments> typeAndAddressProvider() {
    List<Arguments> arguments = new LinkedList<>();
    Arrays.asList(
        Boolean.class,
        Byte.class,
        Short.class,
        // TODO: enable once Calender in implemented
        //Calendar.class,
        Float.class,
        Integer.class,
        String.class)
        .forEach(
            aClass -> Arrays.asList(
                mock(S7Address.class),
                mock(S7BitAddress.class),
                mock(S7DataBlockAddress.class))
                .forEach(s7Address -> arguments.add(Arguments.of(aClass, s7Address)))
        );
    return arguments.stream();
}
项目:shuffleboard    文件:EqualityUtilsTest.java   
private static Stream<Arguments> isDifferentArguments() {
  return Stream.of(
      Arguments.of(null, "null"),
      Arguments.of("null", null),
      Arguments.of("", "A"),
      Arguments.of(new int[0], ""),
      Arguments.of(new int[]{1}, new int[]{2}),
      Arguments.of(new double[]{1.1}, new double[]{1.2}),
      Arguments.of(new byte[]{3}, new byte[]{4}),
      Arguments.of(new short[]{4}, new short[]{5}),
      Arguments.of(new char[]{'a'}, new char[]{'b'}),
      Arguments.of(new boolean[]{true}, new boolean[]{false}),
      Arguments.of(new float[]{2.2f}, new float[]{2.3f}),
      Arguments.of(new Object[]{"Test"}, new Object[]{"Tests"}),
      Arguments.of(new int[0], new double[0])
  );
}
项目:ocraft-s2client    文件:ResponseJoinGameTest.java   
private static Stream<Arguments> responseJoinGameErrorMappings() {
    return Stream.of(
            of(Sc2Api.ResponseJoinGame.Error.MissingParticipation, MISSING_PARTICIPATION),
            of(Sc2Api.ResponseJoinGame.Error.InvalidObservedPlayerId, INVALID_OBSERVED_PLAYER_ID),
            of(Sc2Api.ResponseJoinGame.Error.MissingOptions, MISSING_OPTIONS),
            of(Sc2Api.ResponseJoinGame.Error.MissingPorts, MISSING_PORTS),
            of(Sc2Api.ResponseJoinGame.Error.GameFull, GAME_FULL),
            of(Sc2Api.ResponseJoinGame.Error.LaunchError, LAUNCH_ERROR),
            of(Sc2Api.ResponseJoinGame.Error.FeatureUnsupported, FEATURE_UNSUPPORTED),
            of(Sc2Api.ResponseJoinGame.Error.NoSpaceForUser, NO_SPACE_FOR_USER),
            of(Sc2Api.ResponseJoinGame.Error.MapDoesNotExist, MAP_DOES_NOT_EXIST),
            of(Sc2Api.ResponseJoinGame.Error.CannotOpenMap, CANNOT_OPEN_MAP),
            of(Sc2Api.ResponseJoinGame.Error.ChecksumError, CHECKSUM_ERROR),
            of(Sc2Api.ResponseJoinGame.Error.NetworkError, NETWORK_ERROR),
            of(Sc2Api.ResponseJoinGame.Error.OtherError, OTHER_ERROR));
}
项目:jrestless    文件:OpenIdStandardClaimsTest.java   
public static Stream<Arguments> data() {
    return Stream.of(
ClaimArguments.of(OpenIdStandardClaims::getSub, "sub"),
ClaimArguments.of(OpenIdStandardClaims::getName, "name"),
ClaimArguments.of(OpenIdStandardClaims::getGivenName, "given_name"),
ClaimArguments.of(OpenIdStandardClaims::getFamilyName, "family_name"),
ClaimArguments.of(OpenIdStandardClaims::getMiddleName, "middle_name"),
ClaimArguments.of(OpenIdStandardClaims::getNickname, "nickname"),
ClaimArguments.of(OpenIdStandardClaims::getPreferredUsername, "preferred_username"),
ClaimArguments.of(OpenIdStandardClaims::getProfile, "profile"),
ClaimArguments.of(OpenIdStandardClaims::getPicture, "picture"),
ClaimArguments.of(OpenIdStandardClaims::getWebsite, "website"),
ClaimArguments.of(OpenIdStandardClaims::getEmail, "email"),
ClaimArguments.of(OpenIdStandardClaims::getEmailVerified, "email_verified", true),
ClaimArguments.of(OpenIdStandardClaims::getGender, "gender"),
ClaimArguments.of(OpenIdStandardClaims::getBirthdate, "birthdate"),
ClaimArguments.of(OpenIdStandardClaims::getZoneinfo, "zoneinfo"),
ClaimArguments.of(OpenIdStandardClaims::getLocale, "locale"),
ClaimArguments.of(OpenIdStandardClaims::getPhoneNumber, "phone_number"),
ClaimArguments.of(OpenIdStandardClaims::getPhoneNumberVerified, "phone_number_verified", true),
ClaimArguments.of(OpenIdStandardClaims::getUpdatedAt, "updated_at", 123L));
 }
项目:jrestless    文件:OpenIdIdTokenClaimsTest.java   
public static Stream<? extends Arguments> data(boolean excludeMandatory) {
    List<ClaimArguments<OpenIdIdTokenClaims>> getters = new ArrayList<>();
    if (!excludeMandatory) {
        getters.add(ClaimArguments.of(OpenIdIdTokenClaims::getIss, "iss"));
        getters.add(ClaimArguments.of(OpenIdIdTokenClaims::getSub, "sub"));
        getters.add(ClaimArguments.of(OpenIdIdTokenClaims::getAud, "aud", Collections.singletonList("aud0")));
        getters.add(ClaimArguments.of(OpenIdIdTokenClaims::getSingleAud, "aud"));
        getters.add(ClaimArguments.of(OpenIdIdTokenClaims::getExp, "exp", 123L));
        getters.add(ClaimArguments.of(OpenIdIdTokenClaims::getIat, "iat", 123L));
    }
    getters.add(ClaimArguments.of(OpenIdIdTokenClaims::getAuthTime, "auth_time", 123L));
    getters.add(ClaimArguments.of(OpenIdIdTokenClaims::getNonce, "nonce"));
    getters.add(ClaimArguments.of(OpenIdIdTokenClaims::getAcr, "acr"));
    getters.add(ClaimArguments.of(OpenIdIdTokenClaims::getNonce, "nonce"));
    getters.add(ClaimArguments.of(OpenIdIdTokenClaims::getAmr, "amr", Collections.singletonList("amr0")));
    getters.add(ClaimArguments.of(OpenIdIdTokenClaims::getAzp, "azp"));


    return getters.stream();
}
项目:patience    文件:PatientWaitFutureTest.java   
@Override
public Stream<? extends Arguments> provideArguments(ExtensionContext context) {
    Sleep sleep = Thread::sleep;
    PatientExecutionHandler executionHandler = new SimpleExecutionHandler();
    DelaySupplierFactory delaySupplierFactory = new FixedDelaySupplierFactory(Duration.ZERO);
    PatientExecutable<Boolean> executable = () -> true;
    Predicate<Boolean> filter = bool -> null != bool && bool;
    Supplier<String> messageSupplier = () -> "hello";
    return Stream.of(Arguments.of(null, Duration.ZERO, Duration.ZERO, executionHandler, delaySupplierFactory, executable, filter, messageSupplier),
                     Arguments.of(sleep, null, Duration.ZERO, executionHandler, delaySupplierFactory, executable, filter, messageSupplier),
                     Arguments.of(sleep, Duration.ofMillis(-500), Duration.ZERO, executionHandler, delaySupplierFactory, executable, filter, messageSupplier),
                     Arguments.of(sleep, Duration.ZERO, null, executionHandler, delaySupplierFactory, executable, filter, messageSupplier),
                     Arguments.of(sleep, Duration.ZERO, Duration.ofMillis(-500), executionHandler, delaySupplierFactory, executable, filter, messageSupplier),
                     Arguments.of(sleep, Duration.ZERO, Duration.ZERO, null, delaySupplierFactory, executable, filter, messageSupplier),
                     Arguments.of(sleep, Duration.ZERO, Duration.ZERO, executionHandler, null, executable, filter, messageSupplier),
                     Arguments.of(sleep, Duration.ZERO, Duration.ZERO, executionHandler, delaySupplierFactory, null, filter, messageSupplier),
                     Arguments.of(sleep, Duration.ZERO, Duration.ZERO, executionHandler, delaySupplierFactory, executable, null, messageSupplier),
                     Arguments.of(sleep, Duration.ZERO, Duration.ZERO, executionHandler, delaySupplierFactory, executable, filter, null));
}
项目:patience    文件:PatientRetryFutureTest.java   
@Override
public Stream<? extends Arguments> provideArguments(ExtensionContext context) {
    Sleep sleep = Thread::sleep;
    PatientExecutionHandler executionHandler = new SimpleExecutionHandler();
    DelaySupplierFactory delaySupplierFactory = new FixedDelaySupplierFactory(Duration.ZERO);
    PatientExecutable<Boolean> executable = () -> true;
    Predicate<Boolean> filter = bool -> null != bool && bool;
    Supplier<String> messageSupplier = () -> "hello";
    return Stream.of(Arguments.of(null, Duration.ZERO, 0, executionHandler, delaySupplierFactory, executable, filter, messageSupplier),
                     Arguments.of(sleep, null, 0, executionHandler, delaySupplierFactory, executable, filter, messageSupplier),
                     Arguments.of(sleep, Duration.ofMillis(-500), 0, executionHandler, delaySupplierFactory, executable, filter, messageSupplier),
                     Arguments.of(sleep, Duration.ZERO, -1, executionHandler, delaySupplierFactory, executable, filter, messageSupplier),
                     Arguments.of(sleep, Duration.ZERO, 0, null, delaySupplierFactory, executable, filter, messageSupplier),
                     Arguments.of(sleep, Duration.ZERO, 0, executionHandler, null, executable, filter, messageSupplier),
                     Arguments.of(sleep, Duration.ZERO, 0, executionHandler, delaySupplierFactory, null, filter, messageSupplier),
                     Arguments.of(sleep, Duration.ZERO, 0, executionHandler, delaySupplierFactory, executable, null, messageSupplier),
                     Arguments.of(sleep, Duration.ZERO, 0, executionHandler, delaySupplierFactory, executable, filter, null));
}
项目:junit-dataprovider    文件:AbstractDataProviderArgumentProvider.java   
/**
 * Converts the given data for the given test method and converter context.
 *
 * @param testMethod the original test method for which the data is converted; never {@code null}
 * @param data the data to be converted; never {@code null}
 * @param context the converter context to be used to do the data conversion; never {@code null}
 * @return a {@link Stream} of properly converted arguments; never {@code null}
 * @throws NullPointerException if and only if one of the given arguments is {@code null}
 */
protected Stream<? extends Arguments> convertData(Method testMethod, Object data, ConverterContext context) {
    checkNotNull(testMethod, "'testMethod' must not be null");
    checkNotNull(data, "'data' must not be null");
    checkNotNull(context, "'context' must not be null");

    return dataConverter.convert(data, testMethod.isVarArgs(), testMethod.getParameterTypes(), context).stream()
            .map(objects -> {
                Class<?>[] parameterTypes = testMethod.getParameterTypes();
                for (int idx = 0; idx < objects.length; idx++) {
                    // TODO workaround for https://github.com/junit-team/junit5/issues/1092
                    Class<?> parameterType = parameterTypes[idx];
                    if (parameterType.isPrimitive()) {
                        objects[idx] = convertToBoxedTypeAsWorkaroundForNotWorkingWideningAndUnboxingConversion(
                                objects[idx], parameterType);
                    }
                }
                return objects;
            }).map(Arguments::of);
}
项目:mastering-junit5    文件:CustomArgumentsProvider2.java   
@Override
public Stream<? extends Arguments> provideArguments(
        ExtensionContext context) {

    System.out.println("Arguments provider [2] to test "
            + context.getTestMethod().get().getName());

    return Stream.of(Arguments.of("more", 3), Arguments.of("arguments", 4));
}
项目:mastering-junit5    文件:CustomArgumentsProvider1.java   
@Override
public Stream<? extends Arguments> provideArguments(
        ExtensionContext context) {

    System.out.println("Arguments provider [1] to test "
            + context.getTestMethod().get().getName());

    return Stream.of(Arguments.of("hello", 1), Arguments.of("world", 2));
}
项目:fuse-nio-adapter    文件:OpenOptionsUtilTest.java   
static Stream<Arguments> openOptionsProvider() {
    return Stream.of( //
            Arguments.of(Sets.newHashSet(StandardOpenOption.READ), EnumSet.of(OpenFlags.O_RDONLY)), //
            Arguments.of(Sets.newHashSet(StandardOpenOption.WRITE), EnumSet.of(OpenFlags.O_WRONLY)), //
            Arguments.of(Sets.newHashSet(StandardOpenOption.READ, StandardOpenOption.WRITE), EnumSet.of(OpenFlags.O_RDWR)), //
            Arguments.of(Sets.newHashSet(StandardOpenOption.WRITE, StandardOpenOption.TRUNCATE_EXISTING), EnumSet.of(OpenFlags.O_WRONLY, OpenFlags.O_TRUNC)) //
    );
}
项目:fuse-nio-adapter    文件:BitMaskEnumUtilTest.java   
static Stream<Arguments> argumentsProvider() {
    return Stream.of( //
            Arguments.of(EnumSet.noneOf(TestEnum.class), 0l), //
            Arguments.of(EnumSet.of(TestEnum.ONE), 1l), //
            Arguments.of(EnumSet.of(TestEnum.TWO), 2l), //
            Arguments.of(EnumSet.of(TestEnum.FOUR), 4l), //
            Arguments.of(EnumSet.of(TestEnum.ONE, TestEnum.TWO), 3l), //
            Arguments.of(EnumSet.allOf(TestEnum.class), 7l) //
    );
}
项目:fuse-nio-adapter    文件:FileAttributesUtilTest.java   
static Stream<Arguments> accessModeProvider() {
    return Stream.of( //
            Arguments.of(EnumSet.noneOf(AccessMode.class), 0), //
            Arguments.of(EnumSet.of(AccessMode.READ), AccessConstants.R_OK), //
            Arguments.of(EnumSet.of(AccessMode.WRITE), AccessConstants.W_OK), //
            Arguments.of(EnumSet.of(AccessMode.EXECUTE), AccessConstants.X_OK), //
            Arguments.of(EnumSet.of(AccessMode.READ, AccessMode.WRITE), AccessConstants.R_OK | AccessConstants.W_OK), //
            Arguments.of(EnumSet.allOf(AccessMode.class), AccessConstants.R_OK | AccessConstants.W_OK | AccessConstants.X_OK | AccessConstants.F_OK) //
    );
}
项目:fuse-nio-adapter    文件:FileAttributesUtilTest.java   
static Stream<Arguments> filePermissionProvider() {
    return Stream.of( //
            Arguments.of(PosixFilePermissions.fromString("rwxr-xr-x"), 0755l), //
            Arguments.of(PosixFilePermissions.fromString("---------"), 0000l), //
            Arguments.of(PosixFilePermissions.fromString("r--r--r--"), 0444l), //
            Arguments.of(PosixFilePermissions.fromString("rwx------"), 0700l), //
            Arguments.of(PosixFilePermissions.fromString("rw-r--r--"), 0644l), //
            Arguments.of(PosixFilePermissions.fromString("-w---xr--"), 0214l) //
    );
}
项目:autotest    文件:CsvFileProvider.java   
@Override
public Stream<? extends Arguments> provideArguments(ExtensionContext context) {
    String[] args = DataDeal.getParams(context, this.file);
    CsvParserSettings settings = new CsvParserSettings();
    settings.getFormat().setDelimiter(',');
    settings.getFormat().setQuote('\'');
    settings.getFormat().setQuoteEscape('\'');
    settings.setAutoConfigurationEnabled(false);
    CsvParser csvParser = new CsvParser(settings);
    return Arrays.stream(args).map(csvParser::parseLine).map(Arguments::of);
}
项目:autotest    文件:AutoTestExtension.java   
protected static Stream<? extends Arguments> arguments(ArgumentsProvider provider, ExtensionContext context) {
    try {
        return provider.provideArguments(context);
    } catch (Exception e) {
        throw ExceptionUtils.throwAsUncheckedException(e);
    }
}
项目:stf-console-client    文件:ConnectCommandTest.java   
private static Stream<Arguments> validIndexArrayProvider() {
    return Stream.of(
            Arguments.of(1, "serial_1"),
            Arguments.of(2, "serial_2"),
            Arguments.of(3, "serial_3"),
            Arguments.of(4, "serial_4"));
}
项目:shuffleboard    文件:NetworkTableUtilsTest.java   
private static Stream<Arguments> concatArguments() {
  return Stream.of(
      Arguments.of("/foo/bar", "foo", "bar", new String[0]),
      Arguments.of("/one/two/three/four", "one", "two", new String[]{"three", "four"}),
      Arguments.of("/one/two", "/////one////", "///two", new String[0])
  );
}
项目:shuffleboard    文件:EqualityUtilsTest.java   
private static Stream<Arguments> isEqualArguments() {
  return Stream.of(
      Arguments.of(null, null),
      Arguments.of("Test", "Test"),
      Arguments.of(new int[]{1}, new int[]{1}),
      Arguments.of(new double[]{1.1}, new double[]{1.1}),
      Arguments.of(new byte[]{3}, new byte[]{3}),
      Arguments.of(new short[]{4}, new short[]{4}),
      Arguments.of(new char[]{'a'}, new char[]{'a'}),
      Arguments.of(new boolean[]{true}, new boolean[]{true}),
      Arguments.of(new float[]{2.2f}, new float[]{2.2f}),
      Arguments.of(new Object[]{"Str"}, new Object[]{"Str"})
  );
}
项目:shuffleboard    文件:FxUtilsTest.java   
private static Stream<Arguments> toHexStringArguments() {
  return Stream.of(
      Arguments.of("#000000FF", Color.BLACK),
      Arguments.of("#FF0000FF", Color.RED),
      Arguments.of("#00FF00FF", Color.LIME),
      Arguments.of("#0000FFFF", Color.BLUE),
      Arguments.of("#FFFFFFFF", Color.WHITE),
      Arguments.of("#FFFFFF00", new Color(1.0, 1.0, 1.0, 0.0))
  );
}
项目:shuffleboard    文件:MecanumDriveDataTest.java   
private static Stream<Arguments> createMomentArguments() {
  return Stream.of(
      Arguments.of(new MecanumDriveData(0, 0, 0, 0), 0.0),     // no motion
      Arguments.of(new MecanumDriveData(1, 1, 1, 1), 0.0),     // moments cancel, no rotation
      Arguments.of(new MecanumDriveData(-1, -1, -1, -1), 0.0), // moments cancel, no rotation
      Arguments.of(new MecanumDriveData(1, -1, 1, -1), -1.0),  // rotate clockwise
      Arguments.of(new MecanumDriveData(-1, 1, -1, 1), 1.0),   // rotate counter-clockwise
      Arguments.of(new MecanumDriveData(-1, -1, 1, 1), 0.0)    // no motion
  );
}
项目:shuffleboard    文件:MecanumDriveDataTest.java   
private static Stream<Arguments> createVectorArguments() {
  return Stream.of(
      Arguments.of(new MecanumDriveData(0, 0, 0, 0), new Vector2D(0, 0)),       // no motion
      Arguments.of(new MecanumDriveData(1, 1, 1, 1), new Vector2D(0, 1)),       // full speed forward
      Arguments.of(new MecanumDriveData(-1, -1, -1, -1), new Vector2D(0, -1)),  // full speed back
      Arguments.of(new MecanumDriveData(1, -1, -1, 1), new Vector2D(1, 0)),     // full speed right
      Arguments.of(new MecanumDriveData(-1, 1, 1, -1), new Vector2D(-1, 0)),    // full speed left
      Arguments.of(new MecanumDriveData(-1, -1, 1, 1), new Vector2D(0, 0)),     // no motion
      Arguments.of(new MecanumDriveData(1, 0, 0, 1), new Vector2D(.5, .5)),     // diagonal +x +y
      Arguments.of(new MecanumDriveData(0, 1, 1, 0), new Vector2D(-.5, .5)),    // diagonal -x +y
      Arguments.of(new MecanumDriveData(-1, 0, 0, -1), new Vector2D(-.5, -.5)), // diagonal -x -y
      Arguments.of(new MecanumDriveData(0, -1, -1, 0), new Vector2D(.5, -.5))   // diagonal +x -y
  );
}
项目:shuffleboard    文件:DifferentialDriveWidgetTest.java   
public static Stream<Arguments> createMapArgs() {
  return Stream.of(
      Arguments.of(0, 0, 0, 1, 0, 1),
      Arguments.of(100, 1, 0, 1, 0, 100),
      Arguments.of(100, 1, 0, 1, 99, 100),
      Arguments.of(-1, 0, 0, 1, -1, 0)
  );
}
项目:selenium-jupiter    文件:ForcedAnnotationReaderTest.java   
static Stream<Arguments> forcedTestProvider() {
    return Stream.of(
            Arguments.of(AppiumDriverHandler.class,
                    ForcedAppiumJupiterTest.class, AppiumDriver.class,
                    "appiumNoCapabilitiesTest"),
            Arguments.of(AppiumDriverHandler.class,
                    ForcedAppiumJupiterTest.class, AppiumDriver.class,
                    "appiumWithCapabilitiesTest"),
            Arguments.of(ChromeDriverHandler.class,
                    ForcedBadChromeJupiterTest.class, ChromeDriver.class,
                    "chromeTest"),
            Arguments.of(FirefoxDriverHandler.class,
                    ForcedBadFirefoxJupiterTest.class, FirefoxDriver.class,
                    "firefoxTest"),
            Arguments.of(RemoteDriverHandler.class,
                    ForcedBadRemoteJupiterTest.class, RemoteWebDriver.class,
                    "remoteTest"),
            Arguments.of(EdgeDriverHandler.class,
                    ForcedEdgeJupiterTest.class, EdgeDriver.class,
                    "edgeTest"),
            Arguments.of(OperaDriverHandler.class,
                    ForcedOperaJupiterTest.class, OperaDriver.class,
                    "operaTest"),
            Arguments.of(SafariDriverHandler.class,
                    ForcedSafariJupiterTest.class, SafariDriver.class,
                    "safariTest"));
}
项目:Mastering-Software-Testing-with-JUnit-5    文件:CustomArgumentsProvider2.java   
@Override
public Stream<? extends Arguments> provideArguments(
        ExtensionContext context) {

    System.out.println("Arguments provider [2] to test "
            + context.getTestMethod().get().getName());

    return Stream.of(Arguments.of("more", 3), Arguments.of("arguments", 4));
}
项目:Mastering-Software-Testing-with-JUnit-5    文件:CustomArgumentsProvider1.java   
@Override
public Stream<? extends Arguments> provideArguments(
        ExtensionContext context) {

    System.out.println("Arguments provider [1] to test "
            + context.getTestMethod().get().getName());

    return Stream.of(Arguments.of("hello", 1), Arguments.of("world", 2));
}
项目:roboslack    文件:SlackWebHookServiceTests.java   
@Override
public Stream<? extends Arguments> provideArguments(ExtensionContext context) throws Exception {
    return Stream.of(
            MESSAGE_SIMPLE,
            MESSAGE_MARKDOWN_IN_ATTACHMENT_PRETEXT,
            MESSAGE_MARKDOWN_IN_PLAINTEXT_ATTACHMENT_FIELDS,
            MESSAGE_MARKDOWN_IN_ATTACHMENT_TEXT,
            MESSAGE_MARKDOWN_IN_ATTACHMENT_FIELDS,
            MESSAGE_WITH_ATTACHMENT_FOOTER,
            MESSAGE_WITH_ATTACHMENTS,
            MESSAGE_COMPLEX
    ).map(Arguments::of);
}
项目:filter-sort-jooq-api    文件:FilterMultipleValueParserTimeTest.java   
static Stream<Arguments> goodStringParsableAndResult() {
    return Stream.of(
        Arguments.of("12:12:12", Collections.singletonList(LocalTime.of(12, 12, 12))),
        Arguments.of("12:12:12,12:17:12.000000113,12:15", Arrays.asList(
            LocalTime.of(12, 12, 12),
            LocalTime.of(12, 17, 12, 113),
            LocalTime.of(12, 15)
        ))
    );
}
项目:filter-sort-jooq-api    文件:FilterMultipleValueParserDateTimeTest.java   
static Stream<Arguments> goodStringParsableAndResult() {
    return Stream.of(
        Arguments.of("2017-04-04T12:12:12", Collections.singletonList(LocalDateTime.of(2017, 4, 4, 12, 12, 12))),
        Arguments.of("2017-04-04T12:12:12,2017-05-04T12:17:12,2017-12-25T12:15", Arrays.asList(
            LocalDateTime.of(2017, 4, 4, 12, 12, 12),
            LocalDateTime.of(2017, 5, 4, 12, 17, 12),
            LocalDateTime.of(2017, 12, 25, 12, 15)
        ))
    );
}
项目:filter-sort-jooq-api    文件:FilterMultipleValueParserDateTest.java   
static Stream<Arguments> goodStringParsableAndResult() {
    return Stream.of(
        Arguments.of("2017-04-04", Collections.singletonList(LocalDate.of(2017, 4, 4))),
        Arguments.of("2017-04-04,2017-05-04,2017-12-25", Arrays.asList(
            LocalDate.of(2017, 4, 4),
            LocalDate.of(2017, 5, 4),
            LocalDate.of(2017, 12, 25)
        ))
    );
}
项目:filter-sort-jooq-api    文件:FilteringJooqTest.java   
static Stream<Arguments> goodMapConditionAndResult() {
    return Stream.of(
        Arguments.of(
            ImmutableMap.of(),
            Collections.emptyList(),
            DSL.trueCondition()
        ),
        Arguments.of(
            // this one makes no sense but this is correct ^^
            ImmutableMap.of("key1", "value1", "key2", "12:25:30", "key3", "2017-05-17T12:25:30"),
            createFilterValueTrueConditionPrefixedN("key", 5),
            createNTrueCondition(3)
        ),
        // TODO might fail sometimes as Map of Impl is not predictable in ordering
        Arguments.of(
            ImmutableMap.of("key1", "value1", "key2", "12:25:30", "key3", "2017-05-17T12:25:30"),
            Arrays.asList(Filter.of(
                "key1", "key2",
                v1 -> "val1", v2 -> LocalTime.of(12, 23, 34),
                (v1, v2) -> DSL.field("name", String.class).likeIgnoreCase(v1 + "%")
                    .and(DSL.field("atime", Time.class).ge(Time.valueOf(v2)))),
                Filter.of("key3", LocalDateTime::parse, v1 -> DSL.field("a_date_time", Timestamp.class).lessThan(Timestamp.valueOf(v1))),
                Filter.of("key4", DSL::trueCondition), Filter.of("key5", DSL::trueCondition)),
            DSL.field("name", String.class).likeIgnoreCase("val1%")
                .and(DSL.field("atime", Time.class).ge(Time.valueOf("12:23:34")))
                .and(DSL.field("a_date_time", Timestamp.class).lessThan(Timestamp.valueOf("2017-05-17 12:25:30"))))
    );
}
项目:filter-sort-jooq-api    文件:FilteringJooqTest.java   
static Stream<Arguments> incompleteMapOfFilterMultipleKeys() {
    return Stream.of(
        Arguments.of(
            ImmutableMap.of("key1", "value1", "key2", "12:25:30", "key3", "2017-05-17T12:25:30"),
            Arrays.asList(Filter.of("key1", "missingKey", v1 -> "val1", v2 -> "val2", (val1, val2) -> DSL.trueCondition()), Filter.of("key3", DSL::trueCondition)))
    );
}
项目:ocraft-s2client    文件:RaceTest.java   
private static Stream<Arguments> raceMappings() {
    return Stream.of(
            Arguments.of(Race.NO_RACE, Common.Race.NoRace),
            Arguments.of(Race.TERRAN, Common.Race.Terran),
            Arguments.of(Race.ZERG, Common.Race.Zerg),
            Arguments.of(Race.PROTOSS, Common.Race.Protoss),
            Arguments.of(Race.RANDOM, Common.Race.Random));
}
项目:ocraft-s2client    文件:GameStatusTest.java   
private static Stream<Arguments> gameStatusMappings() {
    return Stream.of(
            Arguments.of(Sc2Api.Status.launched, GameStatus.LAUNCHED),
            Arguments.of(Sc2Api.Status.init_game, GameStatus.INIT_GAME),
            Arguments.of(Sc2Api.Status.in_game, GameStatus.IN_GAME),
            Arguments.of(Sc2Api.Status.in_replay, GameStatus.IN_REPLAY),
            Arguments.of(Sc2Api.Status.ended, GameStatus.ENDED),
            Arguments.of(Sc2Api.Status.quit, GameStatus.QUIT),
            Arguments.of(Sc2Api.Status.unknown, GameStatus.UNKNOWN)
    );
}
项目:ocraft-s2client    文件:PlayerTypeTest.java   
private static Stream<Arguments> playerTypeMappings() {
    return Stream.of(
            Arguments.of(Sc2Api.PlayerType.Participant, PlayerType.PARTICIPANT),
            Arguments.of(Sc2Api.PlayerType.Computer, PlayerType.COMPUTER),
            Arguments.of(Sc2Api.PlayerType.Observer, PlayerType.OBSERVER)
    );
}
项目:ocraft-s2client    文件:DifficultyTest.java   
private static Stream<Arguments> difficultyMappings() {
    return Stream.of(
            Arguments.of(Difficulty.VERY_EASY, Sc2Api.Difficulty.VeryEasy),
            Arguments.of(Difficulty.EASY, Sc2Api.Difficulty.Easy),
            Arguments.of(Difficulty.MEDIUM, Sc2Api.Difficulty.Medium),
            Arguments.of(Difficulty.MEDIUM_HARD, Sc2Api.Difficulty.MediumHard),
            Arguments.of(Difficulty.HARD, Sc2Api.Difficulty.Hard),
            Arguments.of(Difficulty.HARDER, Sc2Api.Difficulty.Harder),
            Arguments.of(Difficulty.VERY_HARD, Sc2Api.Difficulty.VeryHard),
            Arguments.of(Difficulty.CHEAT_VISION, Sc2Api.Difficulty.CheatVision),
            Arguments.of(Difficulty.CHEAT_MONEY, Sc2Api.Difficulty.CheatMoney),
            Arguments.of(Difficulty.CHEAT_INSANE, Sc2Api.Difficulty.CheatInsane)
    );
}
项目:ocraft-s2client    文件:DebugGameStateTest.java   
private static Stream<Arguments> gameStateMappings() {
    return Stream.of(
            Arguments.of(DebugGameState.SHOW_MAP, Debug.DebugGameState.show_map),
            Arguments.of(DebugGameState.CONTROL_ENEMY, Debug.DebugGameState.control_enemy),
            Arguments.of(DebugGameState.FOOD, Debug.DebugGameState.food),
            Arguments.of(DebugGameState.FREE, Debug.DebugGameState.free),
            Arguments.of(DebugGameState.ALL_RESOURCES, Debug.DebugGameState.all_resources),
            Arguments.of(DebugGameState.GOD, Debug.DebugGameState.god),
            Arguments.of(DebugGameState.MINERALS, Debug.DebugGameState.minerals),
            Arguments.of(DebugGameState.GAS, Debug.DebugGameState.gas),
            Arguments.of(DebugGameState.COOLDOWN, Debug.DebugGameState.cooldown),
            Arguments.of(DebugGameState.TECH_TREE, Debug.DebugGameState.tech_tree),
            Arguments.of(DebugGameState.UPGRADE, Debug.DebugGameState.upgrade),
            Arguments.of(DebugGameState.FAST_BUILD, Debug.DebugGameState.fast_build));
}
项目:ocraft-s2client    文件:UnitAttributeTest.java   
private static Stream<Arguments> attributeMappings() {
    return Stream.of(
            of(Data.Attribute.Light, UnitAttribute.LIGHT),
            of(Data.Attribute.Armored, UnitAttribute.ARMORED),
            of(Data.Attribute.Biological, UnitAttribute.BIOLOGICAL),
            of(Data.Attribute.Mechanical, UnitAttribute.MECHANICAL),
            of(Data.Attribute.Robotic, UnitAttribute.ROBOTIC),
            of(Data.Attribute.Psionic, UnitAttribute.PSIONIC),
            of(Data.Attribute.Massive, UnitAttribute.MASSIVE),
            of(Data.Attribute.Structure, UnitAttribute.STRUCTURE),
            of(Data.Attribute.Hover, UnitAttribute.HOVER),
            of(Data.Attribute.Heroic, UnitAttribute.HEROIC),
            of(Data.Attribute.Summoned, UnitAttribute.SUMMONED));
}