import org.junit.Test;

import java.util.LinkedList;
import java.util.Queue;

import static org.junit.Assert.*;

public class UserGraphTest {

    @Test
    public void testInfectSingleUser() {
        User user1 = new User.Builder().build("TestUser");
        Queue<User> infectQueue = new LinkedList<>();
        Version newVersion = new Version(1, 1, 1);

        UserGraph testGraph = new UserGraph.Builder().addUser(user1).build();
        testGraph.infectUser(user1, infectQueue, newVersion);

        assertEquals("Version updated correctly", new Version(1, 1, 1), user1.getCurrentVersion());
        assertEquals("No users added to queue", new LinkedList<User>(), infectQueue);
    }
}
@@ -684,10 +684,1426 @@
 );%0A    %7D
+%0A%0A    @Test%0A    public void testInfectSeveralUsers() %7B%0A        User coach1 = new User.Builder().build(%22Coach1%22);%0A        User coach2 = new User.Builder().build(%22Coach2%22);%0A%0A        User student1 = new User.Builder().addCoach(coach1).build(%22Student1%22);%0A        User student2 = new User.Builder().addCoach(coach1).build(%22Student2%22);%0A        User student3 = new User.Builder().addCoach(coach1).addCoach(coach2).build(%22Student3%22);%0A        User student4 = new User.Builder().addCoach(coach2).build(%22Student4%22);%0A        User student5 = new User.Builder().addCoach(coach2).addStudent(student1).build(%22Student5%22);%0A%0A        Queue%3CUser%3E infectQueue = new LinkedList%3C%3E();%0A        Version newVersion = new Version(1, 1, 1);%0A%0A        UserGraph testGraph = new UserGraph.Builder()%0A                .addUser(coach1)%0A                .addUser(coach2)%0A                .addUser(student1)%0A                .addUser(student2)%0A                .addUser(student3)%0A                .addUser(student4)%0A                .addUser(student5)%0A                .build();%0A%0A        testGraph.infectUser(student5, infectQueue, newVersion);%0A%0A        Queue%3CUser%3E expectedQueue = new LinkedList%3C%3E();%0A        expectedQueue.add(coach2);%0A        expectedQueue.add(student1);%0A%0A        assertEquals(%22Version updated correctly%22, new Version(1, 1, 1), student5.getCurrentVersion());%0A        assertEquals(%22No users added to queue%22, expectedQueue, infectQueue);%0A%0A%0A    %7D
 %0A%7D

Test for infect user.