lundi 12 juin 2017

java Junit test 1 of 2 branches missed

can anyone help me, for test this method

  public int[] selectRandomPosition(int sitzOfGraphic, int sitzOfGraphic2) {

    int width = StdRandom.uniform(0,sitzOfGraphic);
    int height = StdRandom.uniform(0,sitzOfGraphic2);
    return new int[]{width,height};
}

this is my test

 public void randomtest() throws Exception  {

    SetMines set = new SetMines();  
    int[] result = set.selectRandomPosition(10, 10);

    System.out.println(result[0]+"q");
    for(int a = 0; a < 2; a++){
        System.out.println(result[a]);
        Assert.assertTrue(result[a]<11 && result[a]>-1);
    }
}

howevery this is not correct,there is one tipp '2 of 4 branches missed' in Eclemma. Thank u!!!!

Aucun commentaire:

Enregistrer un commentaire