Event Dispatcher  v0.1.6-beta.1
Project that offers a small library that allows to subscribe and fire events.
ArrayArgumentsProvider.java
Go to the documentation of this file.
1 package com.fermod.annotations;
2 
3 import java.util.Arrays;
4 import java.util.List;
5 import java.util.stream.Collectors;
6 import java.util.stream.Stream;
7 
8 import org.junit.jupiter.api.extension.ExtensionContext;
9 import org.junit.jupiter.params.provider.Arguments;
10 import org.junit.jupiter.params.provider.ArgumentsProvider;
11 import org.junit.jupiter.params.support.AnnotationConsumer;
12 
13 public class ArrayArgumentsProvider implements ArgumentsProvider, AnnotationConsumer<ArraySources> {
14  private List<int[]> arguments;
15 
16  public void accept(ArraySources source) {
17  List<ArraySource> arrays = Arrays.asList(source.arrays());
18 
19  this.arguments = arrays.stream().map(ArraySource::array).collect(Collectors.toList());
20  }
21 
22  public Stream<? extends Arguments> provideArguments(ExtensionContext context) {
23  return this.arguments.stream().map(Arguments::of);
24  }
25 
26 }
Stream<? extends Arguments > provideArguments(ExtensionContext context)