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 annotation:
@Parameterized.Parameters
Below is the code I believe to be relevant to this issue:
import static org.junit.Assert.assertEquals;
import java.util.Arrays;
import java.util.Collection;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import calc.CalculatorException;
import calc.ScientificCalculator;
@RunWith(Parameterized.class)
public class ScientificCalculatorTest extends BasicCalculatorTest{
/** Provides an interface to the scientific features of the calculator under test */
private ScientificCalculator sciCalc;
private double a, b;
@Before
@Override
public void setUp() throws Exception {
sciCalc = new ScientificCalculator();
//Make sure that the basic functionality of the extended calculator
//hasn't been broken.
theCalc = sciCalc;
}
/**
* Constructor. Is executed on each test and sets the test values to each pair in the data sets.
* @param nr1 the first number in the tested pair.
* @param nr2 the second number in the tested pair.
*/
public ScientificCalculatorTest(double nr1, double nr2){
a = nr1;
b = nr2;
}
@Parameterized.Parameters
public static Collection<Object[]> testGenerator() {
return Arrays.asList(new Object[][] {
//General integer values | -/+ combinations
{ -100, -100},
{ -100, 100},
{ 100, -100},
{ 100, 100}
});
}
I managed to find some far related questions, such as this. Sadly, in my situation they're of no help.
What I have tried and didn't work:
removing the "extends BasicCalculatorTest" from the class declaration
adding test functions that use the @Test annotation
importing org.junit.runners.Parameterized and using @Parameters instead of @Parameterized.Parameters
I need to mention that I have used a very similar implementation (most notably the annotations and testGenerator()) in another project without any issues. The implementation follows the tutorials available online, such as this, this and this.
Any help on solving this error is greatly appreciated.