org.junit.experimental.theories.ParameterSignature Java Examples

The following examples show how to use org.junit.experimental.theories.ParameterSignature. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestPositionShapeBase.java    From latexdraw with GNU General Public License v3.0 6 votes vote down vote up
@Override
public List<PotentialAssignment> getValueSources(final ParameterSignature sig) {
	return Stream.of(ShapeFactory.INST.createEllipse(),
		ShapeFactory.INST.createCircleArc(),
		ShapeFactory.INST.createGrid(ShapeFactory.INST.createPoint()),
		ShapeFactory.INST.createCircle(),
		ShapeFactory.INST.createRectangle(),
		ShapeFactory.INST.createText(),
		ShapeFactory.INST.createDot(ShapeFactory.INST.createPoint()),
		ShapeFactory.INST.createAxes(ShapeFactory.INST.createPoint()),
		ShapeFactory.INST.createSquare(),
		ShapeFactory.INST.createPlot(ShapeFactory.INST.createPoint(), 0d, 10d, "x", false),
		ShapeFactory.INST.createRhombus(),
		ShapeFactory.INST.createTriangle(),
		ShapeFactory.INST.createPicture(ShapeFactory.INST.createPoint())).
		map(r -> PotentialAssignment.forValue("", r)).collect(Collectors.toList());
}
 
Example #2
Source File: DoubleSupplier.java    From latexdraw with GNU General Public License v3.0 6 votes vote down vote up
@Override
public List<PotentialAssignment> getValueSources(final ParameterSignature sig) {
	final DoubleData doubledata = sig.getAnnotation(DoubleData.class);
	DoubleStream stream = Arrays.stream(doubledata.vals());

	if(doubledata.angle()) {
		stream = DoubleStream.of(0d, Math.PI / 2d, Math.PI, 3d * Math.PI / 2d, 2d * Math.PI, -Math.PI / 2d, -Math.PI,
			-3d * Math.PI / 2d, -2d * Math.PI, 1.234, -1.234, 3d * Math.PI, -3d * Math.PI);
	}

	if(doubledata.bads()) {
		stream = DoubleStream.concat(stream, DoubleStream.of(Double.NaN, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY));
	}

	return stream.mapToObj(i -> PotentialAssignment.forValue("", i)).collect(Collectors.toList());
}
 
Example #3
Source File: FooOrEmptyOrNullStringSupplier.java    From galimatias with MIT License 5 votes vote down vote up
@Override
public List<PotentialAssignment> getValueSources(ParameterSignature sig) {
    FooOrEmptyOrNullString annotation = sig.getAnnotation(FooOrEmptyOrNullString.class);
    String foo = annotation.foo();
    List<PotentialAssignment> res = new ArrayList<PotentialAssignment>();
    for (final String value : new String[]{ foo, "", null }) {
        res.add(PotentialAssignment.forValue(value, value));
    }
    return res;
}
 
Example #4
Source File: TestURL.java    From galimatias with MIT License 5 votes vote down vote up
@Override
public List<PotentialAssignment> getValueSources(final ParameterSignature sig) {
    final TestURLs ref = sig.getAnnotation(TestURLs.class);
    final String dataset = ref.dataset();
    if (!datasetMap.containsKey(dataset)) {
        datasetMap.put(dataset, TestURLLoader.loadTestURLs(dataset));
    }
    final List<PotentialAssignment> values = new ArrayList<PotentialAssignment>();
    for (final TestURL testURL : datasetMap.get(dataset)) {
        values.add(PotentialAssignment.forValue(testURL.toString(), testURL));
    }
    return values;
}
 
Example #5
Source File: AnyNameValueSupplier.java    From galimatias with MIT License 5 votes vote down vote up
@Override
public List<PotentialAssignment> getValueSources(ParameterSignature sig) {
    List<PotentialAssignment> res = new ArrayList<PotentialAssignment>();
    for (final String name : values) {
        for (final String value : values) {
            final NameValue nameValue = new NameValue(name, value);
            res.add(PotentialAssignment.forValue(nameValue.toString(), nameValue));
        }
    }
    return res;
}
 
Example #6
Source File: AnyUrlyStringSupplier.java    From galimatias with MIT License 5 votes vote down vote up
@Override
public List<PotentialAssignment> getValueSources(ParameterSignature sig) {
    AnyUrlyString annotation = sig.getAnnotation(AnyUrlyString.class);
    List<PotentialAssignment> res = new ArrayList<PotentialAssignment>();
    for (final String value : values) {
        res.add(PotentialAssignment.forValue(value, value));
    }
    return res;
}
 
Example #7
Source File: FooOrNullStringSupplier.java    From galimatias with MIT License 5 votes vote down vote up
@Override
public List<PotentialAssignment> getValueSources(ParameterSignature sig) {
    FooOrNullString annotation = sig.getAnnotation(FooOrNullString.class);
    String foo = annotation.foo();
    List<PotentialAssignment> res = new ArrayList<PotentialAssignment>();
    for (final String value : new String[]{ foo, null }) {
        res.add(PotentialAssignment.forValue(value, value));
    }
    return res;
}
 
Example #8
Source File: FooOrEmptyOrNullStringSupplier.java    From galimatias with MIT License 5 votes vote down vote up
@Override
public List<PotentialAssignment> getValueSources(ParameterSignature sig) {
    FooOrEmptyOrNullString annotation = sig.getAnnotation(FooOrEmptyOrNullString.class);
    String foo = annotation.foo();
    List<PotentialAssignment> res = new ArrayList<PotentialAssignment>();
    for (final String value : new String[]{ foo, "", null }) {
        res.add(PotentialAssignment.forValue(value, value));
    }
    return res;
}
 
Example #9
Source File: InvalidMvccEntityGenerator.java    From usergrid with Apache License 2.0 5 votes vote down vote up
@Override
public List<PotentialAssignment> getValueSources( final ParameterSignature sig ) {
    final List<PotentialAssignment> result = new ArrayList<PotentialAssignment>();

    result.add( PotentialAssignment.forValue( "wrongUuidType", wrongUuidType() ) );
    result.add( PotentialAssignment.forValue( "invalidSubTypes", invalidId() ) );

    return result;
}
 
Example #10
Source File: InvalidEntityGenerator.java    From usergrid with Apache License 2.0 5 votes vote down vote up
@Override
public List<PotentialAssignment> getValueSources( final ParameterSignature sig ) {

    final List<PotentialAssignment> result = new ArrayList<PotentialAssignment>();

    final Entity entity = mock( Entity.class );
    when( entity.getId() ).thenReturn( null );
    when( entity.getVersion() ).thenReturn( null );

    result.add( PotentialAssignment.forValue( "nullEntity", null ) );
    result.add( PotentialAssignment.forValue( "nullIdsEntity", entity ) );

    return result;
}
 
Example #11
Source File: InvalidIdGenerator.java    From usergrid with Apache License 2.0 5 votes vote down vote up
@Override
public List<PotentialAssignment> getValueSources( final ParameterSignature sig ) {

    final List<PotentialAssignment> result = new ArrayList<PotentialAssignment>();
    result.add( PotentialAssignment.forValue( "wrongEntityTypeLength", wrongEntityTypeLength() ) );

    return result;
}
 
Example #12
Source File: InvalidIdGenerator.java    From usergrid with Apache License 2.0 5 votes vote down vote up
@Override
public List<PotentialAssignment> getValueSources( final ParameterSignature sig ) {
    final List<PotentialAssignment> result = new ArrayList<PotentialAssignment>();

    result.add( PotentialAssignment.forValue( "nullId", null ) );
    result.add( PotentialAssignment.forValue( "nullEntityId", nullEntityId() ) );
    result.add( PotentialAssignment.forValue( "nullEntityType", nullEntityType() ) );

    return result;
}
 
Example #13
Source File: TestModifiablePointsShapeBase.java    From latexdraw with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<PotentialAssignment> getValueSources(final ParameterSignature sig) {
	final ModifPtShapeData data = sig.getAnnotation(ModifPtShapeData.class);
	final List<Point> pts = Arrays.stream(data.x()).mapToObj(x -> ShapeFactory.INST.createPoint(x, 0d)).collect(Collectors.toList());
	for(int i = 0, size = pts.size(); i < size; i++) {
		pts.get(i).setY(data.y()[i]);
	}

	return Stream.of(ShapeFactory.INST.createBezierCurve(pts),
		ShapeFactory.INST.createPolyline(pts), ShapeFactory.INST.createPolygon(pts)).
		map(r -> PotentialAssignment.forValue("", r)).collect(Collectors.toList());
}
 
Example #14
Source File: TestControlPointShapeBase.java    From latexdraw with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<PotentialAssignment> getValueSources(final ParameterSignature sig) {
	return Stream.of(ShapeFactory.INST.createBezierCurve(Arrays.asList(
		ShapeFactory.INST.createPoint(10d, 20d),
		ShapeFactory.INST.createPoint(30d, 40d)))).
		map(r -> PotentialAssignment.forValue("", r)).collect(Collectors.toList());
}
 
Example #15
Source File: StringSupplier.java    From latexdraw with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<PotentialAssignment> getValueSources(final ParameterSignature sig) {
	final StringData data = sig.getAnnotation(StringData.class);
	Stream<String> stream = Arrays.stream(data.vals());

	if(data.withNull()) {
		stream = Stream.concat(stream, Stream.of((String) null));
	}

	return stream.map(i -> PotentialAssignment.forValue("", i)).collect(Collectors.toList());
}
 
Example #16
Source File: LineArcSupplier.java    From latexdraw with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<PotentialAssignment> getValueSources(final ParameterSignature sig) {
	final LineArcData shapeData = sig.getAnnotation(LineArcData.class);
	final Stream<LineArcProp> instances;

	if(shapeData.withParamVariants()) {
		instances = lineArcDiversified();
	}else {
		instances = Stream.of(ShapeSupplier.createRectangle(), ShapeSupplier.createSquare());
	}

	return instances.map(r -> PotentialAssignment.forValue("", r)).collect(Collectors.toList());
}
 
Example #17
Source File: RestOperationsFactoryTest.java    From bowman with Apache License 2.0 5 votes vote down vote up
@Override
public List<PotentialAssignment> getValueSources(ParameterSignature sig) {
	return asList(
		PotentialAssignment.forValue(
			"deserializerInstance",
			new HandlerInstantiatorTestParams(DummyJsonDeserializer.class,
				(instantiator, clazz) -> instantiator.deserializerInstance(null, null, clazz))
		),
		
		PotentialAssignment.forValue(
			"keyDeserializerInstance",
			new HandlerInstantiatorTestParams(DummyKeyDeserializer.class,
				(instantiator, clazz) -> instantiator.keyDeserializerInstance(null, null, clazz))
		),
		
		PotentialAssignment.forValue(
			"serializerInstance",
			new HandlerInstantiatorTestParams(DummySerializer.class,
				(instantiator, clazz) -> instantiator.serializerInstance(null, null, clazz))
		),
		
		PotentialAssignment.forValue(
			"typeResolverBuilderInstance",
			new HandlerInstantiatorTestParams(DummyTypeResolverBuilder.class,
				(instantiator, clazz) -> instantiator.typeResolverBuilderInstance(null, null, clazz))
		),
		
		PotentialAssignment.forValue(
			"typeIdResolverInstance",
			new HandlerInstantiatorTestParams(DummyTypeIdResolver.class,
				(instantiator, clazz) -> instantiator.typeIdResolverInstance(null, null, clazz))
		)
	);
}
 
Example #18
Source File: FooOrNullStringSupplier.java    From galimatias with MIT License 5 votes vote down vote up
@Override
public List<PotentialAssignment> getValueSources(ParameterSignature sig) {
    FooOrNullString annotation = sig.getAnnotation(FooOrNullString.class);
    String foo = annotation.foo();
    List<PotentialAssignment> res = new ArrayList<PotentialAssignment>();
    for (final String value : new String[]{ foo, null }) {
        res.add(PotentialAssignment.forValue(value, value));
    }
    return res;
}
 
Example #19
Source File: AnyUrlyStringSupplier.java    From galimatias with MIT License 5 votes vote down vote up
@Override
public List<PotentialAssignment> getValueSources(ParameterSignature sig) {
    AnyUrlyString annotation = sig.getAnnotation(AnyUrlyString.class);
    List<PotentialAssignment> res = new ArrayList<PotentialAssignment>();
    for (final String value : values) {
        res.add(PotentialAssignment.forValue(value, value));
    }
    return res;
}
 
Example #20
Source File: AnyNameValueSupplier.java    From galimatias with MIT License 5 votes vote down vote up
@Override
public List<PotentialAssignment> getValueSources(ParameterSignature sig) {
    List<PotentialAssignment> res = new ArrayList<PotentialAssignment>();
    for (final String name : values) {
        for (final String value : values) {
            final NameValue nameValue = new NameValue(name, value);
            res.add(PotentialAssignment.forValue(nameValue.toString(), nameValue));
        }
    }
    return res;
}
 
Example #21
Source File: TestURL.java    From galimatias with MIT License 5 votes vote down vote up
@Override
public List<PotentialAssignment> getValueSources(final ParameterSignature sig) {
    final TestURLs ref = sig.getAnnotation(TestURLs.class);
    final String dataset = ref.dataset();
    if (!datasetMap.containsKey(dataset)) {
        datasetMap.put(dataset, TestURLLoader.loadTestURLs(dataset));
    }
    final List<PotentialAssignment> values = new ArrayList<PotentialAssignment>();
    for (final TestURL testURL : datasetMap.get(dataset)) {
        values.add(PotentialAssignment.forValue(testURL.toString(), testURL));
    }
    return values;
}
 
Example #22
Source File: ShapeSupplier.java    From latexdraw with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<PotentialAssignment> getValueSources(final ParameterSignature sig) throws IOException {
	final ShapeData shapeData = sig.getAnnotation(ShapeData.class);
	final Stream<Shape> instances;

	if(shapeData.withParamVariants()) {
		instances = getDiversifiedShapes();
	}else {
		instances = getStdShapesStream();
	}

	return instances.map(r -> PotentialAssignment.forValue("", r)).collect(Collectors.toList());
}
 
Example #23
Source File: ArcSupplier.java    From latexdraw with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<PotentialAssignment> getValueSources(final ParameterSignature sig) {
	final ArcData shapeData = sig.getAnnotation(ArcData.class);
	final Stream<Arc> instances;

	if(shapeData.withParamVariants()) {
		instances = createDiversifiedArc();
	}else {
		instances = Stream.of(createArc());
	}

	return instances.map(r -> PotentialAssignment.forValue("", r)).collect(Collectors.toList());
}
 
Example #24
Source File: StdGridSupplier.java    From latexdraw with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<PotentialAssignment> getValueSources(final ParameterSignature sig) {
	final StdGridData shapeData = sig.getAnnotation(StdGridData.class);
	final Stream<StandardGrid> instances;

	if(shapeData.withParamVariants()) {
		instances = createDiversifiedStdGrids();
	}else {
		instances = createStdGrids();
	}

	return instances.map(r -> PotentialAssignment.forValue("", r)).collect(Collectors.toList());
}
 
Example #25
Source File: ArrowableSupplier.java    From latexdraw with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<PotentialAssignment> getValueSources(final ParameterSignature sig) {
	final ArrowableData shapeData = sig.getAnnotation(ArrowableData.class);
	final Stream<ArrowableSingleShape> instances;

	if(shapeData.withParamVariants()) {
		instances = createDiversifiedArrowableShapes();
	}else {
		instances = createArrowableShapes();
	}

	return instances.map(r -> PotentialAssignment.forValue("", r)).collect(Collectors.toList());
}
 
Example #26
Source File: RectangularSupplier.java    From latexdraw with GNU General Public License v3.0 4 votes vote down vote up
@Override
public List<PotentialAssignment> getValueSources(final ParameterSignature sig) {
	return Stream.of(ShapeFactory.INST.createRectangle(), ShapeFactory.INST.createEllipse(), ShapeFactory.INST.createRhombus(),
		ShapeFactory.INST.createTriangle())
		.map(r -> PotentialAssignment.forValue("", r)).collect(Collectors.toList());
}
 
Example #27
Source File: EllSupplier.java    From latexdraw with GNU General Public License v3.0 4 votes vote down vote up
@Override
public List<PotentialAssignment> getValueSources(final ParameterSignature sig) {
	return Stream.of(ShapeFactory.INST.createEllipse()).map(r -> PotentialAssignment.forValue("", r)).collect(Collectors.toList());
}
 
Example #28
Source File: TestSquaredShapeBase.java    From latexdraw with GNU General Public License v3.0 4 votes vote down vote up
@Override
public List<PotentialAssignment> getValueSources(final ParameterSignature sig) {
	return Stream.of(ShapeFactory.INST.createSquare(), ShapeFactory.INST.createCircle(), ShapeFactory.INST.createCircleArc()).
		map(r -> PotentialAssignment.forValue("", r)).collect(Collectors.toList());
}
 
Example #29
Source File: CircleSupplier.java    From latexdraw with GNU General Public License v3.0 4 votes vote down vote up
@Override
public List<PotentialAssignment> getValueSources(final ParameterSignature sig) {
	return Stream.of(ShapeFactory.INST.createCircle()).map(r -> PotentialAssignment.forValue("", r)).collect(Collectors.toList());
}
 
Example #30
Source File: TestSetShapesBase.java    From latexdraw with GNU General Public License v3.0 4 votes vote down vote up
@Override
public List<PotentialAssignment> getValueSources(final ParameterSignature sig) {
	return Stream.of(ShapeFactory.INST.createDrawing(),
		ShapeFactory.INST.createGroup()).map(r -> PotentialAssignment.forValue("", r)).collect(Collectors.toList());
}