My question and problem is as follows, I have the method fillVector where I fill a vector with random numbers and now I want to do the unit test with Junit, which is the method testValidos, and I always miss an error and I do not know if it is because the assertArrayEquals can not receive the same vector or because it is. If you can help me I would appreciate it.
public void llenarVector(int vector[]) throws Exception{
Random aleatorio=new Random();
int n=Integer.MIN_VALUE;
// System.out.println(vector.length);
if (vector.length<=MAXIMO){
for(int i=0; i<vector.length; i++)
{
boolean existe=true;
while (existe)
{
n=aleatorio.nextInt(MAXIMO); /* Siguiente valor aleatorio */
existe=comprobar_existe(vector,n);
}
vector[i]=n;
}
}else
throw new Exception("Maximo 100 elementos");
}
@Test
public void testValidos() throws Exception{
System.out.println("Llenar vector");
int[] vector1 = new int[3];
int[] vectorResult= new int[3];
VectorUtilidades instancia1 =new VectorUtilidades();
instancia1.llenarVector(vector1);
assertArrayEquals(vector1,vector1);
}