I have an enum that can present in a number of different ways. As a String, as an Integer and as a Double (different ranges), as a Vector2D and finally as the enum value itself. Here is a generalised example, the values are not representative. The actual use I have for this has a greate deal more values and methods.
public enum Example {
value0("Name0", 0, 0.0, 0.01707, 0.12534);
value1("Name1", 1, 25.0, 0.1707, 0.53434);
value2("Name2", 2, 55.0, 0.70701, 0.23534);
value3("Name3", 3, 65.0, 0.01707, 0.34786);
value5("Name4", 4, 100.0, 0.01707, 0.42594);
private final String name;
private final int number;
private final double head;
private final Vector2d pointVec;
/**
* Constructor invoked for each value above.
*/
enumExample(String name, int no, double hdg, float compX, float CompY) {
this.name = name;
this.number = no;
this.head = hdg;
this.pointVec = new Vector2d(compX, compY);
}
public String getName(){
return name;
}
public int getNumber() {
return no;
}
public int getHead() {
return head;
}
public Vector2D getVector() {
return pointVec;
}
public Example getCalcValue(int value) {
return calcValue(getNumber(value));
}
/*
* There are more methods that perform calculations on the enum's
* attributes.
*/
}
In order to ensure that other classes that make use of this enum are working with a correctly functional enum. I want to have a comprehensive set of tests for it, thus ensuring that the data entry has been performed correctly and that the enum and it's associated data has not got corrupted.
Currently an example of this with 5 enum values has 31 tests. I have a need for versions of this going up to 33 enum values. Which is approx 200 tests.
I was hoping to be able to use data driven testing as this would make checking the test data by eye easier.
Does anybody have any ideas as to how to set this up for an enum? All the examples of data driven testing I've found have a simple class with one method to test.