vendredi 4 décembre 2015

Test method that verifies that the method works as you expect

I just have a quick question about test classes in IntelliJ. My task is to "Write a test method that verifies that the method works as you expect."

This is the method to test:

public int MatchNumber(char[] input, char c) {
 int number = 0;
        for (int i = 0; i < input.length; i++) {
            if (input[i] == c) {
                number++;
            }
        }
        return number;
    }
}

I'm not too sure how exactly test classes work in Java so if somebody could put me on the right lines then I'd be very thankful. Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire