mardi 21 janvier 2020

How to test complex methods like this in JUnit?

[I have been assigned to test this java method and I can't seem to figure out how to do it. Can anyone help?][1] this is a start() method for a game implementation

public void start() {

    Scanner sc = new Scanner(System.in);
    boolean continueGame = true;
    while (continueGame) {
        reset();
        play();
        System.out.println("Do you want a rematch?(y/n)");
        continueGame = sc.hasNextBoolean() ;
    }

Aucun commentaire:

Enregistrer un commentaire