mercredi 29 mai 2019

How to test multiple objects with @ParameterizedTest?

So I want to test objects of different classes (all extending to one class called "Entities") in one test case by using @ParameterizedTest. But Somehow it doesn't work for me. What is the solution to this problem?

I have tried the following (which gives me errors).

@ParameterizedTest
@CsvSource({
    "Car",
    "Airplane",
    "Bike"
})
@Test
void testing_multiple_objects(Object obj) {

    Object object = mock(obj.getClass());

    Coloring.colorOf(null, (Entities) object);

    verify(colorNotFound, never());
}

Aucun commentaire:

Enregistrer un commentaire