Пример #1
0
 @Test
 public void testAddProject() {
   int lastIndex = s.getNumberOfPreferences() - 1;
   s.addProject(testProject_1);
   assertEquals(
       "expected addProject to append object at the end of the array.",
       lastIndex + 1,
       s.getProjects().indexOf(testProject_1));
   for (Project project : testProject_rest) {
     s.addProject(project);
   }
   assertEquals(
       "expect to add %d projects.", testProject_rest.size() + 1, s.getNumberOfPreferences());
 }
Пример #2
0
 @Test
 public void testGetNumberOfStatedPreferences() {
   assertEquals(0, s.getNumberOfStatedPreferences());
   s.addProject(testProject_1);
   assertEquals(0, s.getNumberOfStatedPreferences());
   for (Project p : testProject_rest) {
     s.addProject(p);
   }
   assertEquals(0, s.getNumberOfStatedPreferences());
   s.setNumberOfStatedPreferences(100);
   assertEquals(100, s.getNumberOfStatedPreferences());
   s.preassignProject(testProject_1);
   assertEquals(1, s.getNumberOfStatedPreferences());
 }
Пример #3
0
 @Test
 public void testGetOrderedPreferences() throws Exception {
   for (Project str : testProject_rest) {
     s.addProject(str);
   }
   assertEquals("expect equal", testProject_rest, s.getOrderedPreferences());
 }
Пример #4
0
 @Before
 public void setUp() throws Exception {
   testProject_1 = new Project("Test The Project of the First Non-Sense");
   s = new Student("test student");
   testProject_rest = new ArrayList<Project>();
   Random r = new Random();
   for (int i = 0; i < 50; i++)
     testProject_rest.add(new Project("test project another " + r.nextInt()));
   preped_s = new Student("I'm prepared");
   for (Project p : testProject_rest) {
     preped_s.addProject(p);
   }
 }
Пример #5
0
 @Test
 public void testHasReference() throws Exception {
   s.addProject(testProject_1);
   assertEquals("should have this assignment", true, s.hasPreference(testProject_1));
 }