JUnit's @Parameterized runner provides support for parameterized tests.
Questions tagged [parameterized]
525 questions
20
votes
4 answers
Returning an objects subclass with generics
With an abstract class I want to define a method that returns "this" for the subclasses:
public abstract class Foo {
...
public T eat(String eatCake) {
...
return this;
}
}
public class CakeEater…

Sarabjot
- 489
- 1
- 4
- 13
18
votes
8 answers
A way to see query after parameters are applied?
In a C# application, I'm building a query by creating a query string with parameters, then to the command adding the parameters and their values. For example:
string query = "UPDATE USERS u SET u.username = @PARM_USERNAME " +
"WHERE…

Mike
- 1,246
- 3
- 20
- 34
18
votes
3 answers
Spring Boot / JUnit, run all unit-tests for multiple profiles
I have a BaseTest class which consists of several tests. Each test shall be executed for EVERY profile I list.
I thought about using Parameterized values such as:
@RunWith(Parameterized.class)
@SpringBootTest(webEnvironment =…

Frame91
- 3,670
- 8
- 45
- 89
18
votes
7 answers
passing parameter to jenkins job through curl POST not working?
I try to launch
curl -X POST -u "user:pass" -H Jenkins-Crumb:thecrumbnumber http://myjenkinsserver/jenkins/job/testjob/buildWithParameters?=PARAMETER=somenumber
which works by triggering a parametrized build, but the problem is no value is passed…

kol23
- 1,498
- 3
- 16
- 35
17
votes
5 answers
JSON-Simple causes compiler warning "Type safety: The method put(Object, Object) belongs to the raw type HashMap."
I Just came across a situation where I need to put the data in the JSONObject, while doing that I received a warning from the compiler regarding.
Type safety: The method put(Object, Object) belongs to the raw type HashMap. References to generic…

vaibhav
- 762
- 2
- 12
- 34
17
votes
4 answers
How do I use paramertized generic types in an inner class?
I am trying to implement an inner class that has a generic parameterized type.
Here is a short version of my code:
public class AVLTree> implements Iterable {
...
private class BinaryNode

Will M
- 2,135
- 4
- 22
- 32
16
votes
2 answers
JComboBox is a raw type. References to generic type JComboBox should be parameterized
String[] boxOptions = {"1","2","4","8","16","20","40","100","400"};
JComboBox box = new JComboBox(boxOptions);
I had these exact lines of code in my program before, and wasn't getting this error. I did a bit of searching and the results I found are…

tssguy123
- 185
- 1
- 1
- 9
16
votes
5 answers
With jUnit 4, can I parameterize @BeforeClass?
I am using jUnit to manage integration tests for an application that accesses a database. Because setting up the test data is a time-consuming operation, I have been doing that in the @BeforeClass method, which is executed only once per test class…

Dan Menes
- 6,667
- 1
- 33
- 35
16
votes
2 answers
Pass lambda to parameterized NUnit test
I have a class with a bunch of overloaded operators:
public static double[,] operator +(Matrix matrix, double[,] array)
public static double[,] operator -(Matrix matrix, double[,] array)
public static double[,] operator *(Matrix matrix, double[,]…

Andrey Ermakov
- 3,298
- 1
- 25
- 46
14
votes
4 answers
How to pass string parameter with `IN` operator in stored procedure SQL Server 2008
I have a stored procedure when I execute it I got error
Conversion failed when converting the varchar value '+@dptId+' to data type int
I am getting DepartmentId as a string like (1,3,5,77) and am passing this to my stored procedure.
SQL…

Satinder singh
- 10,100
- 16
- 60
- 102
13
votes
4 answers
Any way to access the type of a Scala Option declaration at runtime using reflection?
So, I have a Scala class that looks like this:
class TestClass {
var value: Option[Int] = None
}
and I'm tackling a problem where I have a String value and I want to coerce it into that Option[Int] at runtime using reflection. So, in another…

Graham Lea
- 5,797
- 3
- 40
- 55
13
votes
4 answers
Java JUnit Parameterized error
I am creating a Java application based on JRE 6. I use JUnit 4 to generate parameterized tests. I am receiving this error:
The annotation @Parameterized.Parameters must define the attribute value
on the line containing the…

Vlad Schnakovszki
- 8,434
- 6
- 80
- 114
12
votes
3 answers
Table-Valued Functions in ORACLE 11g ? ( parameterized views )
I've seen discussions about this in the past, such as here. But I'm wondering if somewhere along the line, maybe 10g or 11g (we are using 11g), ORACLE has introduced any better support for "parameterized views", without needing to litter the…

eidylon
- 7,068
- 20
- 75
- 118
11
votes
6 answers
Issue creating a parameterized thread
I'm having problems trying to create a thread with a ParameterizedThreadStart. Here's the code I have now:
public class MyClass
{
public static void Foo(int x)
{
ParameterizedThreadStart p = new ParameterizedThreadStart(Bar); // no…

Tyler Treat
- 14,640
- 15
- 80
- 115
10
votes
2 answers
Is it possible to parameterize a JUnit Jupiter test with beans from a Spring ApplicationContext?
I would like to write a unit test which is executed for every Spring bean of a given type. JUnit5's parameterized tests offer a lot of possibilities, but I don't know how to inject beans into a method source as it has to be a static method.
Is…

Oliver
- 353
- 1
- 4
- 16