mercredi 26 août 2015

How to test a print method in Java using Junit

I have written a method that is printing output to a console. How should I test it?

public void print(List<Item> items) {
        for (Item item: items){
            System.out.println("Name: " + item.getName());
            System.out.println("Number: " + item.getNumber());

        }
    }

currently, my test looks like this

@Test
    public void printTest() throws Exception {
            (am figuring out what to put here)

    }

Aucun commentaire:

Enregistrer un commentaire