User Tools

Site Tools


2019_2020:s2:td:td8

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
2019_2020:s2:td:td8 [2020/03/04 16:16] – [Questions] blay2019_2020:s2:td:td8 [2020/03/08 15:58] (current) – [De la modélisation au code : FINALE] blay
Line 4: Line 4:
 [[2019_2020:s2:td:coorectionexamintermediaire|Corrections de l'examen intermédiaire]] [[2019_2020:s2:td:coorectionexamintermediaire|Corrections de l'examen intermédiaire]]
  
 +
 +{{:2019_2020:s2:td:exams2-mars2019.pdf|L'examen de l'an passé}}
 ===== La classe "Journey" (30mn) ===== ===== La classe "Journey" (30mn) =====
  
Line 204: Line 206:
  
 <code java> <code java>
-@Test +void testClosestPoint() throws InterruptedException {
- void testClosestPoint() throws InterruptedException {+
  Date currentDate1 = new Date();  Date currentDate1 = new Date();
- DatedPoint currentPoint1 = new DatedPoint(5,5,currentDate1) ;+ DatedPoint currentPoint1 = new DatedPoint(5,5,currentDate1,"domicile") ;
  Thread.sleep(1000);   Thread.sleep(1000); 
  Date currentDate2 = new Date();  Date currentDate2 = new Date();
- DatedPoint currentPoint2 = new DatedPoint(7,7,currentDate2) ;+ DatedPoint currentPoint2 = new DatedPoint(7,7,currentDate2,"p1") ;
  Thread.sleep(1000);   Thread.sleep(1000); 
- DatedPoint currentPoint3 = new DatedPoint(10,10,new Date()) ;+ DatedPoint currentPoint3 = new DatedPoint(10,10,new Date(),"p2") ;
  Thread.sleep(1000);   Thread.sleep(1000); 
- Date currentDate3 = new Date(); 
  Journey path = new Journey(currentPoint1);  Journey path = new Journey(currentPoint1);
  path.addPoint(currentPoint2);  path.addPoint(currentPoint2);
  path.addPoint(currentPoint3);  path.addPoint(currentPoint3);
 + System.out.println(path);
  assertEquals(currentPoint1.getDate(), path.whenWasYouHere(currentPoint1));  assertEquals(currentPoint1.getDate(), path.whenWasYouHere(currentPoint1));
  assertEquals(currentPoint2.getDate(), path.whenWasYouHere(currentPoint2));  assertEquals(currentPoint2.getDate(), path.whenWasYouHere(currentPoint2));
  assertEquals(currentPoint3.getDate(), path.whenWasYouHere(currentPoint3));  assertEquals(currentPoint3.getDate(), path.whenWasYouHere(currentPoint3));
- assertEquals(currentPoint3.getDate(), path.whenWasYouHere(new DatedPoint(12,12,new Date()))); + assertEquals(currentPoint3.getDate(), path.whenWasYouHere(new Point(12,12))); 
- assertEquals(currentPoint1.getDate(), path.whenWasYouHere(new DatedPoint(4,4,new Date()))); + assertEquals(currentPoint1.getDate(), path.whenWasYouHere(new Point(4,4))); 
- assertEquals(currentPoint2.getDate(), path.whenWasYouHere(new DatedPoint(8,8,new Date())));+ assertEquals(currentPoint2.getDate(), path.whenWasYouHere(new Point(8,8)));
   
  }  }
2019_2020/s2/td/td8.1583338587.txt.gz · Last modified: 2020/03/04 16:16 by blay