import java.util.Set; import java.util.HashSet; import java.util.Collections; import java.util.Arrays; import java.util.HashMap; import java.util.Map; import org.junit.Assert; import org.junit.Test; public class SimpleTest { private SchoolAssignmentSolver sas = new BranchAndBoundSolver(); @Test public void testOneSchool() { School school = new School(0, 1); Student student = new Student(school); Map expected = new HashMap<>(); expected.put(student, school); Assert.assertEquals( expected, sas.assign(Collections.singleton(school), Collections.singleton(student)) ); } @Test public void testFitTwo() { School sc1 = new School(0, 2), sc2 = new School(1, 2); Student st1 = new Student(sc1, sc2), st2 = new Student(sc2, sc1); Map expected = new HashMap<>(); expected.put(st1, sc1); expected.put(st2, sc2); Assert.assertEquals(expected, sas.assign(new HashSet<>(expected.values()), expected.keySet())); } }