When I ask for the length in the test I get an error with the casting of the integer, I tried with other classes like Character instead of Integer but I get the same error, java does not let me write Object or Comparable as parametrized classes.
That's a JUnit Test Case
public class EDBinaryHeapTest {
@Test
public void constructorTest01() {
EDBinaryHeap<Integer> toCheck = new EDBinaryHeap<Integer>(0);
assertEquals(0, toCheck.numElementos);
assertEquals(0, toCheck.elementos.length);
}
}
That's the class I`m creating to check
public class EDBinaryHeap<T extends Comparable<T>> implements EDPriorityQueue<T>{
protected T[] elementos;
protected int numElementos;
@SuppressWarnings("unchecked")
public EDBinaryHeap(int numMaxElementos) {
elementos = (T[]) new Comparable[numMaxElementos];
}
}