lundi 4 mai 2015

parameterized junit alway gets "16" in its constructor

i have this code for junit parameterized tests:

@RunWith(Parameterized.class)
public class FreshResultCompareRunner {

    private int responseId;

    private static HashMap<String, CompleteRoutingResponseShort> idsToCompleteResponses = new HashMap<>();

    //This is called before @BeforeClass !
    @Parameterized.Parameters
    public static Collection getRequests() throws IOException {
        Collection<Object[]> params = new ArrayList<>(30);
        for(int i = 0; i < 30; ++i) {
            params.add(new Object[] { i });
        }
        return params;
    }

    //takes the next matrix row from OrganizeTestParameterizedInput()
    public FreshResultCompareRunner(int responseId) {
        this.responseId = responseId;
    }
}

and yet the ctor is called with responseId == 16 once and only.

I set an array of ints [0..30] and yet the ctor is called once and only once with id =16 only.

how do i need to change the syntax?

Aucun commentaire:

Enregistrer un commentaire